; cursor1
Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out
Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

cursor1

VIEWS: 1 PAGES: 1

sql,oracle

More Info
  • pg 1
									                                           CURSOR MANAGEMENT

   1.Update salary by 20% with deptno 33 and put the values in ‘emp1’ table which have same structure.

   Solution

SQL> create table employee(empno number(5),ename varchar(25),job varchar(25),managerno
numer(3),joindate date,pay numer(7),deptno number(3));

Table created

SQL>insert into employee values(1001,’Munwor’,’teacher’,1,’14-jan-1998’,7500,30);
1 row created
SQL>insert into employee values(1002,’Alexander’,’engineer’,2,’12-jun-1995’,4500,32);
1 row created
SQL>insert into employee values(1003,’Holley’,’analyst’,3,’3-feb-1999’,6500,33);
1 row created
SQL>insert into employee values(1004,’Jeorge’,’programmer’,4,’1-mar-2001’,4800,34);
1 row created

SQL> select * from employee;

  EMPNO ENAME                      JOB          MANGERNO JOINDATE PAY DEPTNO
  -------- ------------------------- ------------------------- --------- --------- --------- -------------

   1001         munwor          teacher             1           14-JAN-98        9000         30

   1002         alexander       engineer             2          12-JUN-95         4500         32

   1003         holley          analyst              3          03-FEB-99         6500         33

   1004         jeorge          programmer           4           01-MAR-01        5760         34

SQL>create table emp1 as select * from employee;

Table created

SQL>edit cursor1;

declare
cursor emp is select empno,ename,job,managerno,joindate,pay,deptno from employee where
deptno=&DepartmentCode;
e employee.empno%type;
n employee.ename%type;
j employee.job%type;
m employee.managerno%type;
d employee.joindate%type;
p employee.pay%type;
dp employee.deptno%type;

								
To top