Home » Infrastructure » Windows » Batch File Parameters
Batch File Parameters [message #339022] Wed, 06 August 2008 10:17 Go to next message
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 #339026 is a reply to message #339022] Wed, 06 August 2008 10:27 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>I want the output 1 to be recorded in a operating system variable in batch file.
spool count-out.dat
.
.
.
spool off

place into top & bottom of count.sql
Re: Batch File Parameters [message #339029 is a reply to message #339026] Wed, 06 August 2008 10:42 Go to previous messageGo to next message
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 #339030 is a reply to message #339029] Wed, 06 August 2008 10:51 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
You could increase the chances of getting an answer by actually telling us the operating system.
Re: Batch File Parameters [message #339033 is a reply to message #339022] Wed, 06 August 2008 10:58 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
C:\ might be a clue as to which OS is involved; then again it might not be.
Re: Batch File Parameters [message #339034 is a reply to message #339033] Wed, 06 August 2008 11:03 Go to previous messageGo to next message
amit_kiran
Messages: 50
Registered: July 2006
Location: UK
Member
Hello,

Apologies, my Operating system is Windows XP.

Thanks.
Re: Batch File Parameters [message #339036 is a reply to message #339029] Wed, 06 August 2008 11:05 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And you could increase the chances of getting an answer in posting the question in Windows subforum below.
And more in searching in this forum as this has already been answered.

Regards
Michel
Re: Batch File Parameters [message #339037 is a reply to message #339033] Wed, 06 August 2008 11:08 Go to previous messageGo to next message
ThomasG
Messages: 3211
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

Re: Batch File Parameters [message #339044 is a reply to message #339022] Wed, 06 August 2008 11:23 Go to previous message
amit_kiran
Messages: 50
Registered: July 2006
Location: UK
Member
Hello,

Thank you very much for your valuable time.

Amit.

Previous Topic: Problem in Developer Suite 10G
Next Topic: Report Format length
Goto Forum:
  


Current Time: Thu Mar 28 06:32:33 CDT 2024