|
|
GET DIAGNOSTICS
Gets statement or exception information from the diagnostics area.
where
statement-informationis:Usage
Description
Selected status information from the diagnostics area is retrieved. The diagnostics area holds information about the most recently executed SQL statement. There is only one diagnostics area for each application, independent of the number of connections that the application holds. Observe that the
GET DIAGNOSTICSstatement itself does not change the diagnostics area, although it does setSQLSTATE.The
GET DIAGNOSTICSstatement can be in two forms: the first form retrieves statement information about the most recent SQL statement executed. The second form ofGET DIAGNOSTICSis theEXCEPTIONform, which retrieves exception information for the most recently executed SQL statement. The ordinal number of the exception to be returned is specified immediately following the keywordEXCEPTION.statement-information Information Items
The information items for
statement-informationare described in the following table:exception-info Information Items
The information items for
exception-infoare described in the following table:
Information item
Data type
Description
CATALOG_NAMEVARCHAR(128) The catalog name of the schema containing the table on which the violated constraint is defined, always an empty string ("").CLASS_ORIGINVARCHAR(128) The defining source of the two first characters (the class portion) of theSQLSTATEvalue.COLUMN_NAMEVARCHAR(128) The name of the table column on which the violated constraint is defined. If the constraint involves more than one column or the data change operation causing the exception is not in the table on which the constraint is defined, this will be an empty string ("").CONDITION_IDENTIFIERVARCHAR(128) The value specified forcondition-namein the DECLARE CONDITION statement declaring the exception as a named condition. This will be the empty string ("") if the exception has not been declared as a named condition.CONDITION_NUMBERINTEGER The ordinal number of the exception on the diagnostics exception stack.CONNECTION_NAMEVARCHAR(128) The connection name specified in aCONNECT,DISCONNECTorSET CONNECTIONstatement. The name of the current connection for all other statements.CONSTRAINT_CATALOGVARCHAR(128) The catalog name of the schema containing the violated constraint, always an empty string ("").CONSTRAINT_SCHEMAVARCHAR(128) The name of the schema containing the violated constraint.CONSTRAINT_NAMEVARCHAR(128) The name of the violated constraint.CURSOR_NAMEVARCHAR(128) The name of the cursor which is in an invalid state, when the exception:24000 - `Invalid Cursor State'is raised.MESSAGE_LENGTHINTEGER The length of the message text for the specified exception.MESSAGE_OCTET_LENGTHINTEGER Currently the same asMESSAGE_LENGTH.MESSAGE_TEXTVARCHAR(254) The descriptive message text for the specified exception.NATIVE_ERRORINTEGER The internal Mimer SQL return code relating to the exception. See the Mimer SQL Programmer's Manual, Appendix B, Return Codes.PARAMETER_NAMEVARCHAR(128) The name of the routine parameter causing the exception.RETURNED_SQLSTATECHAR(5) Value ofSQLSTATEfor the specified exception.ROUTINE_CATALOGVARCHAR(128) The catalog name of the schema containing the function or procedure in which the exception was raised, always an empty string ("").ROUTINE_SCHEMAVARCHAR(128) The name of the schema containing the function or procedure in which the exception was raised.ROUTINE_NAMEVARCHAR(128) The name of the function or procedure in which the exception was raised.SCHEMA_NAMEVARCHAR(128) The name of the schema containing the table on which the violated constraint is defined. If the data change operation causing the exception is not in the table on which the constraint is defined, this will be an empty string ("").SERVER_NAMEVARCHAR(128)The database name specified in a
CONNECT,DISCONNECTorSET CONNECTIONstatement. The current database name for all other statements.SPECIFIC_NAMEVARCHAR(128) Currently a unique name generated by the system.SUBCLASS_ORIGINVARCHAR(128) The defining source of the three last characters (the subclass portion) of theSQLSTATEvalue.TABLE_NAMEVARCHAR(128) The name of the table on which the violated constraint is defined. If the data change operation causing the exception is not in the table on which the constraint is defined, this will be an empty string ("").TRIGGER_CATALOGVARCHAR(128) The catalog name of the schema containing the table supporting the trigger in which the exception was raised, always an empty string ("").TRIGGER_SCHEMAVARCHAR(128) The name of the schema containing the table supporting the trigger in which the exception was raised.TRIGGER_NAMEVARCHAR(128) The name of the trigger in which the exception was raised.Values for COMMAND_FUNCTION and DYNAMIC_FUNCTION
The
COMMAND_FUNCTIONandDYNAMIC_FUNCTIONinformation items can contain any of the following values:
Language Elements
target-variable, see Target Variables.Notes
The exception requested by the
GET DIAGNOSTICS EXCEPTIONform must be one of the exceptions that exist in the diagnostics area, i.e. the exception number must be in the range from 1 up to the value ofNUMBER.Example
... exec sql GET DIAGNIOSTICS :cnt = NUMBER; for (int i = 1; i <= cnt; i++) { exec sql GET DIAGNOSTICS EXCEPTION :i :sqlstatestr = RETURNED_SQLSTATE, :errmsgstr = MESSAGE_TEXT, :errmsglen = MESSAGE_LENGTH; ... } ...Standard Compliance
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|