|
|
GET DIAGNOSTICS
Gets statement or condition 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, apart from settingSQLSTATE.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 theCONDITIONform, which retrieves condition information for the most recently executed SQL statement. The ordinal number of the condition to be returned is specified immediately following the keywordCONDITION.statement-information Information Items
The information items for
statement-informationare described in the following table:condition-info Information Items
The information items for
condition-infoare described in the following table:
Information item
Data type
Description
CATALOG_NAMENCHAR VARYING(128) The catalog name of the schema containing the table on which the violated constraint is defined, always an empty string ("").CLASS_ORIGINNCHAR VARYING(128) The defining source of the two first characters (the class portion) of theSQLSTATEvalue.COLUMN_NAMENCHAR VARYING(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 condition is not in the table on which the constraint is defined, this will be an empty string ("").CONDITION_IDENTIFIERNCHAR VARYING(128) The value specified forcondition-namein the DECLARE CONDITION statement declaring the condition as a named condition. This will be the empty string ("") if the condition has not been declared as a named condition.CONDITION_NUMBERINTEGER The ordinal number of the condition on the diagnostics condition stack.CONNECTION_NAMENCHAR VARYING(128) The connection name specified in aCONNECT,DISCONNECTorSET CONNECTIONstatement. The name of the current connection for all other statements.CONSTRAINT_CATALOGNCHAR VARYING(128) The catalog name of the schema containing the violated constraint, always an empty string ("").CONSTRAINT_SCHEMANCHAR VARYING(128) The name of the schema containing the violated constraint.CONSTRAINT_NAMENCHAR VARYING(128) The name of the violated constraint.CURSOR_NAMENCHAR VARYING(128) The name of the cursor which is in an invalid state, when the condition:24000 - 'Invalid Cursor State'is raised. ERROR_LENGTH INTEGER The length in characters of the relevant part the SQL statement, starting atERROR_POSITION.ERROR_POSITION INTEGER The position in the SQL statement where the specified condition occurred.Value < 1 means unknown position.MESSAGE_LENGTHINTEGER The length of the message text for the specified condition.MESSAGE_OCTET_LENGTHINTEGER Currently the same asMESSAGE_LENGTH.MESSAGE_TEXTNCHAR VARYING(254) The descriptive message text for the specified condition.NATIVE_ERRORINTEGER The internal Mimer SQL return code relating to the condition. See the Mimer SQL Programmer's Manual, Appendix C, Return Codes.PARAMETER_NAMENCHAR VARYING(128) The name of the routine parameter causing the condition.RETURNED_SQLSTATECHAR(5) Value ofSQLSTATEfor the specified condition.ROUTINE_CATALOGNCHAR VARYING(128) The catalog name of the schema containing the function, method or procedure in which the condition was raised, always an empty string ("").ROUTINE_SCHEMANCHAR VARYING(128) The name of the schema containing the function, method or procedure in which the condition was raised.ROUTINE_NAMENCHAR VARYING(128) The name of the function, method or procedure in which the condition was raised.SCHEMA_NAMENCHAR VARYING(128) The name of the schema containing the table on which the violated constraint is defined. If the data change operation causing the condition is not in the table on which the constraint is defined, this will be an empty string ("").SERVER_NAMENCHAR VARYING(128)The database name specified in a
CONNECT,DISCONNECTorSET CONNECTIONstatement. The current database name for all other statements.SPECIFIC_NAMENCHAR VARYING(128) Specific name of the procedure, method or function in which the condition was raised.SUBCLASS_ORIGINNCHAR VARYING(128) The defining source of the three last characters (the subclass portion) of theSQLSTATEvalue.TABLE_NAMENCHAR VARYING(128) The name of the table on which the violated constraint is defined. If the data change operation causing the condition is not in the table on which the constraint is defined, this will be an empty string ("").TRIGGER_CATALOGNCHAR VARYING(128) The catalog name of the schema containing the table supporting the trigger in which the condition was raised, always an empty string ("").TRIGGER_SCHEMANCHAR VARYING(128) The name of the schema containing the table supporting the trigger in which the condition was raised.TRIGGER_NAMENCHAR VARYING(128) The name of the trigger in which the condition 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 condition requested by the
GET DIAGNOSTICS CONDITIONform must be one of the conditions that exist in the diagnostics area, i.e. the condition number must be in the range from 1 up to the value ofNUMBER.Example
... exec sql GET DIAGNOSTICS :cnt = NUMBER; for (int i = 1; i <= cnt; i++) { exec sql GET DIAGNOSTICS CONDITION :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 |
|
|