Release-Informationen


42.7 Additional Options in the GET DIAGNOSTICS Statement

GET DIAGNOSTICS Statement

The GET DIAGNOSTICS statement is used to obtain information about the previously executed SQL statement. The syntax of this statement has been updated as follows.

Befehlssyntax

>>-GET DIAGNOSTICS---------------------------------------------->
 
>--+-SQL-variable-name--=--+-ROW_COUNT-----+-+-----------------><
   |                       '-RETURN_STATUS-' |
   '-| condition-information |---------------'
 
condition-information
 
|--EXCEPTION--1------------------------------------------------->
 
   .-,------------------------------------------.
   V                                            |
>----SQL-variable-name--=--+-MESSAGE_TEXT-----+-+---------------|
                           '-DB2_TOKEN_STRING-'
 
 

Befehlsparameter

SQL-variable-name
Identifies the variable that is the assignment target. If ROW_COUNT or RETURN_STATUS is specified, the variable must be an integer variable. Otherwise, the variable must be CHAR or VARCHAR. SQL variables can be defined in a compound statement.

ROW_COUNT
Identifies the number of rows associated with the previous SQL statement. If the previous SQL statement is a DELETE, INSERT, or UPDATE statement, ROW_COUNT identifies the number of rows deleted, inserted, or updated by that statement, excluding rows affected by triggers or referential integrity constraints. If the previous statement is a PREPARE statement, ROW_COUNT identifies the estimated number of result rows in the prepared statement.

RETURN_STATUS
Identifies the status value returned from the stored procedure associated with the previously executed SQL statement, provided that the statement was a CALL statement invoking a procedure that returns a status. If the previous statement is not such a statement, then the value returned has no meaning and could be any integer.

condition-information
Specifies that the error or warning information for the previously executed SQL statement is to be returned. If information about an error is needed, the GET DIAGNOSTICS statement must be the first statement specified in the handler that will handle the error. If information about a warning is needed, and if the handler will get control of the warning condition, the GET DIAGNOSTICS statement must be the first statement specified in that handler. If the handler will not get control of the warning condition, the GET DIAGNOSTICS statement must be the next statement executed.

MESSAGE_TEXT
Identifies any error or warning message text returned from the previously executed SQL statement. The message text is returned in the language of the database server where the statement is processed. If the statement completes with an SQLCODE of zero, an empty string or blanks are returned.

DB2_TOKEN_STRING
Identifies any error or warning message tokens returned from the previously executed SQL statement. If the statement completes with an SQLCODE of zero, or if the SQLCODE has no tokens, then an empty string or blanks is returned.


[ Seitenanfang | Vorherige Seite | Nächste Seite | Inhaltsverzeichnis | Index ]