Batch File Parameters [message #339022] |
Wed, 06 August 2008 10:17 |
amit_kiran
Messages: 50 Registered: July 2006 Location: UK
|
Member |
|
|
Hi,
I want to retrieve values from an SQL file into an Operating system prameter using batch file.
My Batch file would look like this.
@echo on
setlocal
mkdir DailyReports_%a%_TCMCTF
sqlplus tcmsys/tcmsys@UAT1_GUB @C:\Database\BCR753\UAT\count.sql
@echo
pause
Count.sql will contain
Select count(1) from dual;
I want the output 1 to be recorded in a operating system variable in batch file.
Your help in this matter would be much appreciated.
Thank You.
Amit.
|
|
|
|
Re: Batch File Parameters [message #339029 is a reply to message #339026] |
Wed, 06 August 2008 10:42 |
amit_kiran
Messages: 50 Registered: July 2006 Location: UK
|
Member |
|
|
Hello,
I want the output of the sql file to be recorded in an Operating system variable.
Count(1) from dual will return 1. This 1 value should be stored in Operating system variable.
Thanks.
|
|
|
|
|
|
|
Re: Batch File Parameters [message #339037 is a reply to message #339033] |
Wed, 06 August 2008 11:08 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Well, "c:\" USED to be a pretty good clue, but in the later versions of Windows (W2K3 / Vista) there have been some shell extensions which might have come in handy.
One way is to spool to a additional *.cmd and set the variable there :
test.sql writes that additional set.cmd :
spool set.cmd
set feedback off
set heading off
select 'set MYVAR=' || count(*) from dual;
spool off
exit;
The calling script :
@echo off
sqlplus -s user/pass@db @test.sql
call set.cmd
echo VAR = %MYVAR%
[Updated on: Wed, 06 August 2008 11:09] Report message to a moderator
|
|
|
|