Skip to content

SQLWARNING

DECLARE
salary number(10,2);
BEGIN
salary := 8000;
IF salary > 5000 THEN
DBMS_OUTPUT.PUT('High Salary Warning. It is: ' || salary);
END IF;
END;
High Salary Warning. It is: 8000

The above SQL warning code block for Oracle declares a salary variable and assigns a value. Then it checks if the salary is greater than 5000. If it is, a warning message is outputted. It’s just a simple demonstration and SQL itself does not have a native SQLWARNING mechanism similar to SQLException, this way Oracle’s DBMS_OUTPUT.PUT() function is used to simulate a warning message.