0% found this document useful (0 votes)
5 views2 pages

SQL

A new table 'emp2' is created with employee details and three records are inserted. A PL/SQL procedure 'updatelowsalary' is defined to update salaries of employees earning below a specified limit. The procedure is executed to increase the salaries of eligible employees, and the updated records are displayed.

Uploaded by

suhel563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

SQL

A new table 'emp2' is created with employee details and three records are inserted. A PL/SQL procedure 'updatelowsalary' is defined to update salaries of employees earning below a specified limit. The procedure is executed to increase the salaries of eligible employees, and the updated records are displayed.

Uploaded by

suhel563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL> create table emp2(empid int primary key,name varchar(50),salary decimal(10,2));

Table created.

SQL> insert into emp2 values(1,'navya',30000);

1 row created.

SQL> insert into emp2 values(2,'sameer',25000);

1 row created.

SQL> insert into emp2 values(3,'navedhi',40000);

1 row created.

SQL> create or replace procedure updatelowsalary(

2 salary_limit in decimal,

3 increment in decimal

4 )

5 is

6 cursor emp_cursor is

7 select empid from emp2 where salary<salary_limit for

8 update;

9 emp_id int;

10 begin

11 for emp_record in emp_cursor loop


12 update employee

13 set salary=salary+increment

14 where empid=emp_record.empid;

15 end loop;

16 end;

17 /

Procedure created

SQL>exec updatelowsalary(35000,5000);

PL/SQL procedure successfully completed

SQL> select*from emp2;

EMPID NAME SALARY

---------- -------------------------------------------------- ----------

1 nethish 30000

2 deepika 25000

3 kumar 40000

You might also like