Fetch data from Oracle SP Out Param SYS_REFCURSOR in Unix Korn Shell Script -


i have stored procedure in oracle out parameter sys ref_cursor. need execute sp korn shell . read output , use email body. not find example code read sys ref cursor in unix. below code. how can read cur ? print cur doesnt seem print output.

#!/usr/bin/ksh  function runproc {     #read ref cursor proc     cur=`sqlplus -s $connectiondetails <<eof         set pagesize 0 feedback on verify off heading off echo off         var return_val ;         exec myproc_retcur(weeknum ,return_val);             exit;         eof`         print return_val     return cur }  #---start----- runproc cur sendmail "weekly load test results", cur 

you have print return_val in wrong place; shoudl inside sql*plus command, before exit, print out ref cursor variable.

you need prefix return_val colon in procedure call, indicate it's using bind variable declared - though omitted variable type declaration well. seems want:

function runproc {     #read ref cursor proc     cur=`sqlplus -s $connectiondetails <<eof         set pagesize 0 feedback on verify off heading off echo off         var return_val refcursor         exec myproc_retcur(14, :return_val);         print return_val         exit         eof`     return cur } 

you haven't shown weeknum coming i've hard-coded number now.

i think want set feedback off, not on, incidentally.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -