Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Instream SQL in an NT Batch script
I raised this back in March and suggested the following 2 options:
Option 1
For single line commands, you can use something like:
echo connect user/pwd_at_sid | sqlplus /nolog
However, this isn't really very useful.
Option 2
More useful is something like:
rem --start of batch file
( echo connect user/pwd_at_sid
echo select user from dual;
echo select sysdate from dual;
) | sqlplus /nolog
rem --end batch file
Tanel Poder replied and said you could use Option 3
sqlplus "/ as sysdba" < con
select 1 from dual;
select 2 from dual;
exit
But when I copied that into a batch file and ran it, it sits at the =
sqlplus prompt until I hit <ctrl-z> and then the window goes (if I leave =
the exit in) or it says "'select' is not recognized as an internal or =
external command,
operable program or batch file." if I take the exit out and put a pause =
in - so I was missing something. I'd also be keen to work out how to =
get Option 3 working.
HTH,
Bruce Reardon
=20
NOTICE: This e-mail and any attachments are private and confidential and =
may contain legally privileged information. If you are not an =
authorised recipient, the copying or distribution of this e-mail and any =
attachments is prohibited and you must not read, print or act in =
reliance on this e-mail or attachments. This notice should not be =
removed.
-----Original Message-----
From: Smith, Ron L.
Sent: Thursday, 22 July 2004 7:00 AM
I am trying to move a couple of Unix scripts to an NT server. I know just about everything needs to change but the scripts use in stream SQL commands and for some reason NT doesn't like the syntax.
The code is simple just like:
sqlplus / <<EOF
select something from somewhere;
EOF
It complains and says <<EOF not expected here. =3D20
Works on Unix and Linux.
What am I missing?
Thanks!
Ron
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlReceived on Wed Jul 21 2004 - 18:43:13 CDT
-----------------------------------------------------------------