INVALID_GET_DIAGNOSTICS_USAGE error condition

SQLSTATE: 42612

Invalid usage of GET DIAGNOSTICS statement.

MULTIPLE_CALLS

GET DIAGNOSTICS statement can be called only once from the same exception handler.

MULTIPLE_ROW_COUNT

GET DIAGNOSTICS may assign ROW_COUNT to at most one variable in a single statement.

NOT_IN_EXCEPTION_HANDLER

GET DIAGNOSTICS statement can only be used from within an exception handler.

NOT_IN_ORDER

GET DIAGNOSTICS must be called after all declarations in the compound, but before any other statement in the compound.

ROW_COUNT_OUTSIDE_SCRIPT

GET DIAGNOSTICS ... = ROW_COUNT is only valid inside a SQL script or stored procedure body.