1
votes

Let say I need to execute some sql code from shell script.
What could be simple and neat approach to do this?

1
There are already a lot of questions about running SQL*Plus from a shell script - is another one useful? - Alex Poole

1 Answers

2
votes
sqlplus -s /nolog <<EOF
whenever sqlerror exit sql.sqlcode;
set echo on;
set serveroutput on;
connect <user>/<pass>@<host>:<port>/<sid>

delete from <table_name> where <...>;
...

quit;
EOF