column name of a cursor [message #295463] |
Tue, 22 January 2008 06:49  |
susantaindia
Messages: 12 Registered: January 2008 Location: India
|
Junior Member |
|
|
How can i get the column name of a cursor dynamically.
The cursor select statement is <select * from emp>.
|
|
|
Re: column name of a cursor [message #295480 is a reply to message #295463] |
Tue, 22 January 2008 07:40   |
farooq112
Messages: 90 Registered: September 2006 Location: cairo
|
Member |
|
|
cursor doda is
select *
from emp
v number;
e varchar2(20);
d number(10);
begin
open doda;
loop
fetch doda into v;e;d;
exit when doda %not found;
:view.empno:=v;
:view.ename:e;
:view.deptno
end loop;
end;
note : view >>> block name
emp >>>> item name
thats simple
|
|
|
|
Re: column name of a cursor [message #295497 is a reply to message #295463] |
Tue, 22 January 2008 08:25   |
farooq112
Messages: 90 Registered: September 2006 Location: cairo
|
Member |
|
|
hi Littlefoot
what do you mean all
full of errors try this
i think now every thing gooooooooooooood Littlefoot
tell me anything
cursor doda is
select *
from emp
where sal=:view.sal;
v number;
e varchar2(20);
d number(10);
begin
open doda;
loop
fetch doda into v;e;d;
exit when doda %not found;
:view.empno:=v;
:view.ename:e;
:view.deptno;
end loop;
end;
note : view >>> block name
emp >>>> item name
thats simple
|
|
|
|
|
Re: column name of a cursor [message #295620 is a reply to message #295589] |
Tue, 22 January 2008 22:31   |
susantaindia
Messages: 12 Registered: January 2008 Location: India
|
Junior Member |
|
|
Hi,
Matter is not so simple.
It is like that...
I don't know the column name of the declared cursor and I want to know the column names of the declared cursor through
program code.
|
|
|
|
Re: column name of a cursor [message #295651 is a reply to message #295628] |
Wed, 23 January 2008 00:29   |
susantaindia
Messages: 12 Registered: January 2008 Location: India
|
Junior Member |
|
|
Hi David,
This not only for EMP table and that can be any table.If i use join query in a cursor declaration then 'user_tab_columns' will not be useful for me.
My requiremet is as below:
declare
cursor abc is
select empno,ename,job,mgr,hiredate,sal,comm,dname
from emp a,dept b where a.deptno=b.deptno;
col varchar2(100)
begin
for i in abc
loop
for j in 1..8
loop
col := 'i.'||abc.columnname(j); <not possible>
message(col);
end loop;
end loop;
end;
Susan
|
|
|
|
Re: column name of a cursor [message #296170 is a reply to message #295884] |
Thu, 24 January 2008 23:33   |
susantaindia
Messages: 12 Registered: January 2008 Location: India
|
Junior Member |
|
|
Hello Devid,
This is a real life problem.I am making Excel file from Oracle table with respect to Dynamic SQL query.User will pass the sql statement through my Form and Excel file will be generated accordingly.
Susan
|
|
|
|
|