| Neeraj |
Posted: Jun 20, 2008 06:24:15 AM |
Total Post: 254
Joined: Jan, 2007
|
hi,
i want to create a cursor w/ multiple column so how to create it & how to fetch that values.
cursor ci is
select empno,empname from emp;
thxs |
|
|
newuser |
| Posted: Jun 20, 2008 11:27:58 AM | |
|
Total Post: 6
Joined: Feb, 2008
|
hi,
hope this will help ... i created to fetch 2 column for a single row only
declare
e_empname varchar2(20);
e_empid number(5);
cursor c1 is
select empname,empid from emp;
begin
open c1;
fetch c1 into e_empname,empid;
dbms_output.put_line(e_empname||e_empid);
close c1;
end;
|
|
|
|
|
Neeraj |
| Posted: Jun 21, 2008 01:49:07 AM | |
|
Total Post: 254
Joined: Jan, 2007
|
thxs frd,
can u tell me how to update empid of every empname with another empid in another table.i want to update empid of emp table w/ empid of emp1 table but like set emp.empno=emp.empno-emp1.empno
declare
e_empname varchar2(20);
e_empid number(5);
cursor c1 is
select empname,empid from emp;
begin
open c1;
fetch c1 into e_empname,empid;
dbms_output.put_line(e_empname||e_empid);
close c1;
end;
thxs again
|
|
|
|
|
Vish |
| Posted: Jul 27, 2008 08:15:48 AM | |
|
Total Post: 50
Joined: Jan, 2007
|
you can use for loop
like this
for c1 in c1_rec loop
...
....
.....
end for
in for loop u didn't have to do loop and u didnt have to open cursor and fetch and exit, it will take care by for loop
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |