execute immediate will work in SQL Block in shell script?
871594May 10 2012 — edited May 10 2012Hi Friends,
i am wirting script to get the account id's corresponding to CIF from oracle table and need to pass to procedure.
Here first_org and last_org are shell variables.
When i execute the below program it is throwing execute not found.
Can you please correct me where i made a mistake? and also please let me know how to display some content in below sql block ?dbms_output.put_line or print which need to use and provide me the syntax for both.
`sqlplus -s crmuser/******@dotis11<<ENDOFSQL
whenever sqlerror exit 1
declare
qstr varchar2(200);
facid varchar2(20);
Lacid varchar2(20);
begin
qstr:='select ACCOUNTID from accounts where ORGKEY=:1';
execute immediate qstr into facid using $first_org;
dbms_output.put_line(facid);
qstr:='select ACCOUNTID from accounts where ORGKEY=:1';
execute immediate qstr into Lacid using $last_org;
dbms_output.put_line(Lacid);
exec Retail_Otu_Dedup_Account(facid,Lacid)
end;
/
exit;
ENDOFSQL`
Thanks,
Venkat Vadlamudi.