Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to invoke Windows SQL command from a batch file?
srini wrote:
> Hi all,
>
> I have the following question:
>
> I have SQLPlus on my Windows 2000 box:
> -----------------------------------------------
> D:\upgrades\new\CC>sqlplus srini/srini_at_srini
> SQL*Plus: Release 8.1.7.0.0 - Production on Wed Apr 27 20:34:15 2005
> (c) Copyright 2000 Oracle Corporation. All rights reserved.
> Connected to:
> Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
> With the Partitioning option
> JServer Release 8.1.7.4.0 - Production
> SQL>
> ----------------------------------------------
>
> Now I want to have a batch file, test.bat with the following two
lines:
> --------------------------------------------------
> sqlplus srini/srini_at_srini
> select bytes/power(1024,3) from dba_segments where
> segment_name='ATTACHMENTS_BLOB';
> ------------------------------------------------
>
> But when I run test.bat from the command line, it is not giving me
the
> output of the "select" command.
>
> How can I get the command output from a batch file without logging
into
> the SQL shell?
>
> Thanks in advance,
> Srini
test.bat :
echo off
(echo select bytes/power(1024,3) from dba_segments
echo where segment_name = 'ATTACHMENTS_BLOB';
)> query.tmp
sqlplus -S system/password_at_service < query.tmp
del query.tmp
Regards,
Koki
Received on Thu Apr 28 2005 - 00:42:16 CDT