Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Create SQL Batch File
Mohamed Badr wrote:
> Hello,
> I want to make a linux or dos batch file to run a SQL Command
> i.e. SQLPLUS.exe scott/tiger SQL_COMMAND
> so how can I write this batch file like that.
Something like this (for Linux):
-- sql.sh script --
#!/bin/sh
# usage : sql.sh "SQL STATEMENT"
sqlplus -s << EOF
scott/tiger
$1
/
exit;
EOF
-- sql.sh script --
This will work for both SQL statements and PL/SQL blocks
Usage and output looks like this (pasted from bash):
$ sql.sh "select sysdate from dual"
SYSDATE
PL/SQL procedure successfully completed.
-- BillyReceived on Thu Jan 09 2003 - 06:38:57 CST
![]() |
![]() |