RE: help in Dynamic SQL

RE: help in Dynamic SQL

 

  

Hi tarun
The following code works for

create or replace procedure proc(columnname varchar)
as
type nameslist is table of varchar(20);
names nameslist;
sqlst varchar(50):='';
begin

sqlst:='select '||columnname||' from test';
execute immediate sqlst bulk collect into names;
dbms_output.put_line('hi names'||names(1)||'hi '||names(2));
end;

if doesn't work please reply
though if it works reply me

cheeeeeeeeeeer's

Raj



-----Original Message-----
From: tarun-bansal
[mailto:oracledba-ezmlmshield-x30726400.[Email address protected]
Sent: Friday, June 29, 2007 6:21 PM
To: LazyDBA Discussion
Subject: help in Dynamic SQL



Hi

I want to get the values of one column from a table but dont know the name
of
column at the time of creation of procedute where i want the output.
I have to use Dynamic SQL, but the problem is, the output of that query is
more
than one records, so how can i get the required data by using dynamic SQL.

Detail
Table is Month
There are 4 columns(A1,A2,A3,A4)
Query is << select p from month >>
and pass this p from the parameter of procedure.
So i want to get the output of that query....

Plz help me out..

Regards
Tarun Bansal

----------------------------------------------------------------------
This mail sent through Toaster-Horde (http://qmailtoaster.clikka.com/)


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




Oracle LazyDBA home page