Home » Developer & Programmer » Forms » column name of a cursor (Forms developer 10g)
column name of a cursor [message #295463] Tue, 22 January 2008 06:49 Go to next message
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 Go to previous messageGo to next message
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 #295484 is a reply to message #295480] Tue, 22 January 2008 07:57 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
farooq112
thats simple

Very simple indeed. It doesn't work at all.

Where's the point in posting something full of errors?
Re: column name of a cursor [message #295497 is a reply to message #295463] Tue, 22 January 2008 08:25 Go to previous messageGo to next message
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 #295570 is a reply to message #295497] Tue, 22 January 2008 15:20 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you actually try it?

Here's a list of possible errors (and the ones you get after fixing a previous one):
- no DECLARE keyword
- Encountered the symbol "NOT" (should be "%NOTFOUND")
- PLS-00394: wrong number of values in the INTO list of a FETCH statement as variables are to be separated by comma, not semi-colon
- PLS-00394: wrong number of values in the INTO list of a FETCH statement once again, as the number of columns in 'emp' table is larger than number of variables you declared

Etc.; I don't feel like discovering a wheel.
icon6.gif  Re: column name of a cursor [message #295589 is a reply to message #295463] Tue, 22 January 2008 17:05 Go to previous messageGo to next message
farooq112
Messages: 90
Registered: September 2006
Location: cairo
Member
Littlefoot Laughing thank you for everything Grin

now i sent form aready i try it

everything goooooooooooooooood Mad

check and tel me any thing wrong if youfount

from egypt thank you Littlefoot

  • Attachment: farooq.fmb
    (Size: 52.00KB, Downloaded 203 times)
Re: column name of a cursor [message #295620 is a reply to message #295589] Tue, 22 January 2008 22:31 Go to previous messageGo to next message
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 #295628 is a reply to message #295463] Tue, 22 January 2008 22:51 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
susantaindia wrote on Tue, 22 January 2008 23:49
How can i get the column name of a cursor dynamically.
The cursor select statement is <select * from emp>.
Do you want the column names of the cursor or of the table 'emp'? If the latter then just make an inquiry of 'user_tab_columns' or 'all_tab_columns'.

David
Re: column name of a cursor [message #295651 is a reply to message #295628] Wed, 23 January 2008 00:29 Go to previous messageGo to next message
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 #295884 is a reply to message #295651] Wed, 23 January 2008 16:54 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Is this a real world exercise or a course? If the latter, then talk with you colleagues, work as a group.

What do you intend doing with this information?

David
Re: column name of a cursor [message #296170 is a reply to message #295884] Thu, 24 January 2008 23:33 Go to previous messageGo to next message
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


Re: column name of a cursor [message #296717 is a reply to message #296170] Mon, 28 January 2008 19:11 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I googled 'how to find cursor column name' and found http://www.experts-exchange.com/Database/Miscellaneous/Q_22626717.html (you have to go to the bottom for the full answer.

Basically, use the 'dbms_sql' package 'describe' facility.

David
Re: column name of a cursor [message #296743 is a reply to message #296717] Mon, 28 January 2008 22:58 Go to previous message
susantaindia
Messages: 12
Registered: January 2008
Location: India
Junior Member
Thanks David.
Previous Topic: how can i call graph fro mform
Next Topic: Help in building a form
Goto Forum:
  


Current Time: Sun Dec 04 16:35:25 CST 2016

Total time taken to generate the page: 0.19813 seconds