Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: PL/SQL - Use bind variable in "from <table>" query

Re: PL/SQL - Use bind variable in "from <table>" query

From: Lyndon Tiu <ltiu_at_alumni.sfu.ca>
Date: Mon, 31 Jan 2005 21:45:57 -0800
Message-Id: <200501312145.57192.ltiu@alumni.sfu.ca>


OK, I figured it out, you need to create the statement as a string first using the concat operator ||:

begin

<... pl sql code ...>

        select_stmt := 'select ' || v_record_type || ' from ' || v_table_view_name || ' where ' || v_record_pk_field_name || ' = ' || new.record_pk_field_name;

        execute immediate select_stmt into v_value;

<... more pl sql code ..>

end

Thanks.

--

Lyndon Tiu
--

http://www.freelists.org/webpage/oracle-l Received on Tue Feb 01 2005 - 00:48:37 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US