set serveroutput on;
declare
d date;
rec jobs%rowtype;
cursor c1 (param varchar2) is
select * from jobs where job_id like '%' || param
;
begin
dbms_output.put_line('hello world');
select sysdate into d from dual;
if sql%found THEN
dbms_output.put_line(sql%rowcount || ' selected');
else
dbms_output.put_line('failed to select');
end if;
dbms_output.put_line('explicit cursor1');
open c1('&1');
loop
fetch c1 into rec;
exit when c1%notfound;
dbms_output.put_line(rec.job_id || ', ' || rec.job_title);
end loop;
close c1;
dbms_output.put_line('explicit cursor2');
for rec2 in c1('&1')
loop
dbms_output.put_line(rec2.job_id || ', ' || rec2.job_title);
end loop;
dbms_output.put_line('implicit cursor');
for rec3 in (select * from jobs where job_id like '%&1')
loop
dbms_output.put_line(rec3.job_id || ', ' || rec3.job_title);
end loop;
rollback;
exception
when others then
rollback;
raise;
end;
/