RaiseAppERR-2

RaiseAppERR-2 - PROGRAM WITHOUT RAISE APPLICATION ERROR...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 /* PROGRAM WITH Raise Application Error*/ CREATE or REPLACE PROCEDURE raise_salary (emp_id NUMBER, amount NUMBER) AS curr_sal NUMBER BEGIN SELECT sal INTO curr_sal FROM emp WHERE empno = emp_id IF curr_sal IS NULL THEN /* Issue user-defined error message. */ raise_application_error(-20101, 'Salary is missing') ELSE UPDATE emp SET sal = curr_sal + amount WHERE empno = emp_id END IF END raise_salary -------------------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: /* PROGRAM WITHOUT RAISE APPLICATION ERROR*/ CREATE OR REPLACE PROCEDURE raise_salary (emp_id NUMBER, amount NUMBER) AS curr_sal NUMBER BEGIN SELECT sal INTO curr_sal FROM emp WHERE empno = emp_id IF curr_sal IS NULL THEN raise NO_DATA_FOUND ELSE UPDATE emp SET sal = curr_sal + amount WHERE empno = emp_id END IF EXCEPTION when NO_DATA_FOUND then DBMS_OUTPUT.PUT_LINE('error') END raise_salary...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online