Connect to sqlplus in a shell script and run SQL scripts Connect to sqlplus in a shell script and run SQL scripts bash bash

Connect to sqlplus in a shell script and run SQL scripts


For example:

sqlplus -s admin/password << EOFwhenever sqlerror exit sql.sqlcode;set echo off set heading off@pl_script_1.sql@pl_script_2.sqlexit;EOF


Wouldn't something akin to this be better, security-wise?:

sqlplus -s /nolog << EOFCONNECT admin/password;whenever sqlerror exit sql.sqlcode;set echo off set heading off@pl_script_1.sql@pl_script_2.sqlexit;EOF 


If you want to redirect the output to a log file to look for errors or something. You can do something like this.

sqlplus -s <<EOF>> LOG_FILE_NAME user/passwd@host/db#Your SQL codeEOF