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

  • From: Lyndon Tiu <ltiu@xxxxxxxxxxxxx>
  • To: Mladen Gogala <gogala@xxxxxxxxxxxxx>
  • Date: Mon, 31 Jan 2005 21:45:57 -0800

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
--
//www.freelists.org/webpage/oracle-l

Other related posts: