Thanks for the question, Learner.
Asked: June 28, 2019 - 4:31 pm UTC
Last updated: July 01, 2019 - 9:46 am UTC
Version: 11
Viewed 1000+ times
sqlplus -s user/passw@schema_name << EOF set markup csv on set numwidth 20 SET FEEDBACK OFF spool /mydir/test_ext/test.dat; var c refcursor exec :c := TEST_FUNCTION( 'PARAM1', 'PARAM2' ) print c spool off; EOF cp /mydir/test_ext/test.dat /Newdir/test_ext/test.dat
create table t ( c1 int, c2 int ); insert into t values ( 1, 1 ); insert into t values ( 1, 2 ); insert into t values ( 2, 2 ); commit; create or replace function test_function ( p int ) return sys_refcursor as cur sys_refcursor; begin open cur for select * from t where c1 = p and c2 = p; return cur; end test_function; / var c refcursor declare p int; begin select max ( c1 ) into p from t; :c := test_function( p ); end; / print c C1 C2 ---------- ---------- 2 2
Learner DN, July 02, 2019 - 4:06 pm UTC
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library