Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP NEEDED Passing column name as a parameter in store procedure 1

Status
Not open for further replies.

JawwadLone

Programmer
Mar 17, 2004
57
PK
Below the is Oracle procedure:
Code:
PROCEDURE proc_BARRACKLookup
	(
		cur_out OUT cursor_type,
		p_query IN varchar2
	)
as 
sqlstatement varchar2(200):='open cur_out for select '||	p_query ||' from	employee';
	begin
  execute immediate  sqlstatement ;
	end;
i m trying to retrieve records by passing column of employee table in "p_query" parameter.problem i m having is that i dont know exactly how to assign the value to cursor in this scenario.

regards
Jawwad
 
Ok, a bit better. I assume that your cursor_type is declared correctly.

Code:
PROCEDURE proc_BARRACKLookup
    (
        cur_out OUT cursor_type,
        p_query IN varchar2
    )
is
begin 
   open cur_out for 'select ' || p_query || ' from employee';

end;

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top