User Tools

Site Tools

A PCRE internal error occured. This might be caused by a faulty plugin

Sidebar

**HPL/SQL is included to Apache Hive since version 2.0** * [[home|Home]]\\ * [[why|Why HPL/SQL]]\\ * [[features|Key Features]]\\ * [[start|Get Started]]\\ * [[doc|HPL/SQL Reference]]\\ * [[download|Download]]\\ * [[new|What's New]]\\ * [[about|About]]

activity_count

====== ACTIVITY_COUNT Variable - PL/HQL ====== ACTIVITY_COUNT built-in variable contains the number of rows affected by the last SQL statement. **Important Note:** Currently Hive does not support JDBC Statement.getUpdateCount(), so for INSERT statements ACTIVITY_COUNT will return 0 for Hive 0.13 and earlier and -1 for Hive 0.14 and later. See [[https://issues.apache.org/jira/browse/HIVE-7680|HIVE-7680]] for more details. Currently you can use ACTIVITY_COUNT only with SELECT statements in Hive. If SELECT INTO returns a row ACTIVITY_COUNT is set to 1. Also if you use a cursor each FETCH statement increments ACTIVITY_COUNT by 1. **Example**: <code language=sql> DECLARE var INT; SELECT id INTO var FROM default.dual; IF ACTIVITY_COUNT = 1 THEN PRINT 'id = ' || var; END IF; </code> **Compatibility:** Teradata **Version**: PL/HQL 0.3.1 **See also:** * [[get-diagnostics|GET DIAGNOSTICS ROW_COUNT]] * [[sqlcode|SQLCODE]] * [[sqlstate|SQLSTATE]]