The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question, Arya.
Asked: December 02, 2016 - 5:32 pm UTC
Last updated: December 05, 2016 - 11:08 am UTC
Version: 11
Viewed 1000+ times
create table t ( id int, status varchar2(10) ); insert into t values (1, 'RETIRED'); insert into t values (2, 'EMPLOYED'); declare stts t.status%type := 'RETIRED'; begin for emps in ( select * from t where status = stts ) loop dbms_output.put_line(emps.id); end loop; end; / PL/SQL procedure successfully completed. 1 declare stts t.status%type := 'EMPLOYED'; begin for emps in ( select * from t where status = stts ) loop dbms_output.put_line(emps.id); end loop; end; / PL/SQL procedure successfully completed. 2
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library