execute immediate in pl/sql block not functioning
Hello,
I've made a short plsql block which create's a bind variable on an dynamic select. when i try this in sqplus with a dbms_output.put_line(v_temp) the correct value is displayed but within the execute immediate commando the bind variable is not filled. Here's the code:
DECLARE
v_count number(5) := 1;
v_text varchar2(200);
v_temp varchar2(200);
BEGIN
select count(*) into v_count from v_survey_questions where page_id=2;
for c1 in 1..v_count
loop
v_temp:='select text into :P2_Q'||c1||' from v_survey_questions where page_id=2 and ord='||c1||'';
execute immediate v_temp;
end loop;
END;
Any help would be appreciated.
Thanks Leo.