get-diagnostics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

get-diagnostics [2015/09/23 20:27] (current)
Line 1: Line 1:
 +====== GET DIAGNOSTICS Statement - PL/HQL ======
  
 +GET DIAGNOSTICS statement allows you to retrieve the error message, the number of rows about the previous SQL statement.
 +
 +**Syntax**:
 +
 +Get the error text:
 +
 +<code language=sql>​
 +GET DIAGNOSTICS EXCEPTION 1 var_name = MESSAGE_TEXT;​
 +</​code>​
 +
 +Get the number of rows associate with the previous SQL statement:
 +
 +<code language=sql>​
 +GET DIAGNOSTICS var_name = ROW_COUNT;
 +</​code>​
 +
 +**Important Note:**
 +
 +  * Hive does not support JDBC Statement.getUpdateCount() for INSERT statements, so GET DIAGNOSTICS ROW_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.
 +
 +**Compatibility:​** IBM DB2
 +
 +**Version**:​ PL/HQL 0.03
 +
 +**See also:**
 +  * [[error-handling|Error Handling]]
 +  * [[declare-handler|DECLARE HANDLER]]
 +  * [[activity_count|ACTIVITY_COUNT]]
 +  * [[sqlcode|SQLCODE]]
 +  * [[sqlstate|SQLSTATE]]