I have a SQL procedure in a file and I would like to call this procedure in a sh script then send the result in a file (no matter where is the file).
I do not know if I am doing well or not but here what I wrote :
#!/bin/ksh
#exit 0
VAR=$(sqlplus /NOLOG <<!
connect E760/E760@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST=p595n11)(PORT=1521))(CONNECT_DATA = (SID = DBUVNSD5)))@PA_IND_DELAYS_BODY.sql;
!)
result=`sqlplus / <<SCRIPT| grep ^result | sed "s/^result: //"
set serveroutput on
declare
var_truc_result VARCHAR2(255);
begin
export_csv('$1','$2');
dbms_output.put_line( 'result: ' || var_truc_result);
end;
/
exit
SCRIPT`
sqlplus "system/ADMIN" <<!
exec export_csv($0,$1);
!
echo var_truc_result is: "$result"