Sunday, 9 June 2013

PL/SQL program for simple cursors

Create table employee29(eno varchar2(30),salary number(10));


Inserting values in the table:

Insert into employee29 values('e1001',20000);
Insert into employee29 values('e1002',15000);
Insert into employee29 values('e1003',17000);
Insert into employee29 values('e1004',10000);
Insert into employee29 values('e1005',21000);


PL/SQL block:

BEGIN
update employee29 set salary=salary+1000 where eno='&eno';
if SQL%FOUND then
dbms_output.put_line('updated successfully');
end if;
if SQL%NOTFOUND then
dbms_output.put_line('not existing');
end if;
END;

Output:

No comments:

Post a Comment