0

I wrote a .sh script which should upload data from file by sql*loader and then run stored procedure which should proceed uploaded data.

#!/bin/bash
ORACLE_HOME=/opt/app/oracle/product/10.2.0/db_1
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
export ORACLE_SID=RSK

sqlldr userid=MY_SCHEME/PASS@MY_SID control=!_control_file.ctl LOG=upload.log errors=100

# SQl procedures start  
sqlplus -s MY_SCHEME@RSK/PASS<<end
# Procedure which transport data from stage tables to table_procedure_1
execute MY_SCHEME.procedure_1();
commit;
execute MY_SCHEME.procedure_2(); 
commit;
end

#exit from .sh script
exit; 

As a result i have uploaded data, but MY_SCHEME.procedure_1() doesn't proceed uploaded data. It seems that there was not data commiting after uploading. Please, help me coorect my scipt. Thank you.

p.s. when i run procedure using sql*plus (not from .sh scirpt) it works fine.

It works coorectly:

sqlplus scheme/pass@database<<end
SET SERVEROUTPUT ON                       
begin                                     
  dbms_output.put_line ('Running procedure 1');
  proc1();
  COMMIT; 
  dbms_output.put_line('procedure completed');
end;
/ 
exit
end

Thanks to everybody!!!

May12
  • 2,420
  • 12
  • 63
  • 99

1 Answers1

1

Your problem is probably with sqlplus command line. You use sqlplus -s user@schema/password when it is required to use sqlplus user/password@schema .
Of course the -s switch that turns sqlplus completely silent does not really help.

Also, you should include an EXIT command inside the SQLplus script (before the eof line).

Benoit
  • 76,634
  • 23
  • 210
  • 236
  • @May12: if that works correctly then you can accept the answer. And please don't post passwords! – Benoit May 15 '12 at 09:57