Hi,
Here documents are a way to do this, or if you have the sql statements in a 'sql-file' you can call sql with that file.
Here document example:
Code:
#!/bin/bash
sqlplus -s user/password <<EOF
SET PAGES 0
SET ECHO OFF
SET FEEDBACK OFF
SET TERMOUT OFF
SET LINES 132
SPOOL /tmp/dis_spec_const.sql
SELECT x from y where a equals b
SPOOL off
EOF
All between The first EOF and the closing EOF will be given to sqlplus.
Using a file that sqlplus 'executes' is also possible:
Code:
#!/bin/bash
sqlplus user/passwd @dir/sql-commands.do
All the commands in dir/sql-commands.do are executed.
Hope this helps.