I tried both of the followings and both got error. What is the correct syntax? Thanks.
----------------------------------------------
First and the error is "[Error] Execution (1: 1): ORA-00936: missing expression ORA-06512: at line 4".
declare HQList1 varchar2(1000);
HQ varchar2(10) := 'XYZ';
begin
EXECUTE IMMEDIATE '
select HQList into ' || HQList1 || '
from HQLIST
where ID = ''' || HQ || '''';
dbms_output.put_line(HQList1);
end;
----------------------------------------------
Second and the error is "[Error] Execution (1: 1): ORA-00905: missing keyword ORA-06512: at line 4".
declare HQList1 varchar2(1000);
HQ varchar2(10) := 'XYZ';
begin
EXECUTE IMMEDIATE '
select HQList into HQList1
from HQLIST
where ID = ''' || HQ || '''';
dbms_output.put_line(HQList1);
end;
----------------------------------------------