Home » SQL & PL/SQL » SQL & PL/SQL » how to pass column name and table name as arguments to a function
how to pass column name and table name as arguments to a function [message #254420] Thu, 26 July 2007 13:35 Go to next message
ford_orafaq
Messages: 5
Registered: July 2007
Junior Member
The following one is a procedure that I got from earlier replies:

create or replace procedure orafaq(v_column_name in varchar2,
v_table_name in varchar2) as
v_rc sys_refcursor;
v_value varchar2(100);
begin
open v_rc for 'select ' || v_column_name || ' from ' ||v_table_name;
loop
fetch v_rc into v_value;
exit when v_rc%notfound;
dbms_output.put_line( v_value );
end loop;
close v_rc;
end;

Anybody suggest to convert it to function without having print command and with return class...
Re: how to pass column name and table name as arguments to a function [message #254433 is a reply to message #254420] Thu, 26 July 2007 13:55 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Return the ref cursor without fetching it just opening it.

Regards
Michel
Previous Topic: How can we delete duplicate values in table
Next Topic: delete duplicate rows
Goto Forum:
  


Current Time: Sat Dec 03 09:43:12 CST 2016

Total time taken to generate the page: 0.09618 seconds