SQLWARNING is part of the SQL/PSM (Persistent Stored Modules) condition-handling framework. The SQL standard classifies every execution condition with a five-character SQLSTATE. Class '01' is reserved for warnings (for example '01000' – general warning, '01003' – null value eliminated). By referring to SQLWARNING inside a DECLARE HANDLER, SIGNAL, or RESIGNAL statement you can treat every warning uniformly without listing each individual SQLSTATE.When the database issues any warning during the execution of a stored procedure, function, trigger, or compound statement, control transfers to the matching SQLWARNING handler (CONTINUE, EXIT, or UNDO). Inside the handler you can log, raise a different error, correct data, or ignore the problem. You can also raise a warning manually with SIGNAL SQLWARNING, letting the caller know something is not fatal but worth attention.Because warnings do not roll back transactions automatically, it is up to the developer to decide whether to continue or abort after catching SQLWARNING. Always check the diagnostics area (GET DIAGNOSTICS) for additional detail such as MESSAGE_TEXT, COLUMN_NUMBER, and CONSTRAINT_NAME.
SQL:1999 (SQL/PSM)
SQLWARNING groups all SQLSTATE class '01' conditions so you can catch or raise every warning with a single keyword.
Use CONTINUE to resume execution after the handler, typically for logging. Use EXIT to abandon the compound statement, effectively treating warnings as errors.
By default, warnings are non-fatal. You can make them fatal by re-signalling an error inside the SQLWARNING handler or setting strict SQL modes (for example in MySQL).
Yes. Declare additional handlers for exact SQLSTATE values such as '01003' before the generic SQLWARNING handler. The first match in declaration order is used.