CREATE TABLE cursor_example(
emp_id NUMBER(10) PRIMARY KEY,
emp_name VARCHAR2(30),
emp_salary NUMBER(6)
);
SELECT * FROM cursor_example;
INSERT INTO cursor_example VALUES(1234,'apple',1250);
INSERT INTO cursor_example VALUES(1235,'banana',1500);
INSERT INTO cursor_example VALUES(1236,'carrot',1750);
INSERT INTO cursor_example VALUES(1237,'donkey',2050);
INSERT INTO cursor_example VALUES(1238,'elixr',15075);
UPDATE cursor_example
SET emp_salary = emp_salary + (.25*emp_salary);
DECLARE affected_emp NUMBER(2);
BEGIN
UPDATE cursor_example
SET emp_salary = emp_salary + (.25*emp_salary);
IF sql%notfound THEN
DBMS_OUTPUT.PUTLINE('NO PEOPLE AFFECTED');
ELSEIF sql%found THEN
DBMS_OUTPUT.PUTLINE(affected_emp || 'PEOPLE AFFECTED');
ENDIF;
END;
The error message I got is :
ORA-06550: line 7, column 12: PLS-00103: Encountered the symbol "SQL" when expecting one of the following: := . ( @ % ;