get diagnostics considerations for SQL

In the context of the SQL query language, you can use the get diagnostics statement to handle multiple SQL Errors.

The get diagnostics statement returns SQL error information. You can code the get diagnostics statements in Execute #SQL{…}

Example

The following example shows the get diagnostics statement:

numerrors int;
Execute #SQL{
	GET DIAGNOSTICS :numerrors = NUMBER;
};

retsqlstate char(5);
for (i int from 1 to numerrors)
	Execute #SQL{
		GET DIAGNOSTICS CONDITION :i
			:retsqlstate = RETURNED_SQLSTATE;
	};
	sysLib.writeStdout( "SQLSTATE :" + retsqlstate );
end

Compatibility

Table 1. Compatibility considerations for delete
Platform Issue
Java™ generation and Debug The get diagnostics statement is not supported. Generation will be successful, but the use of the get diagnostics statement will return a sqlException at runtime or when running this through the debugger.

Feedback