Example :-
write PL/SQL Block, the salaries of all the employees in the ‘employees’ from
department_no 50 are updated. If none of the employee’s salary are updated we get a
message 'None of the salaries where updated'.
Else we get a message like for example, 'Salaries are updated'
Implicit cursors are automatically created when you issue
select statement it used by oracle.
it is created by default when you issue dml statements like insert
,delete,update,select.
declare num_of_emp number;
BEGIN
UPDATE employees
SET salary = salary + 2000 where department_id=&dno;
IF SQL%NOTFOUND THEN
dbms_output.put_line('None of the salaries where updated');
ELSIF SQL%FOUND THEN
num_of_emp := SQL%ROWCOUNT;
dbms_output.put_line('Salaries for ' || num_of_emp || 'employees are up
d');
END IF;
END;
/
0 comments:
Post a Comment