Tim,
Thank you for your help. The caret character did the trick for escaping |. 
Somewhere down the line I even had to escape a 0. When I was trying to echo set 
linesize 0>>C:\filename.sql it failed and I had to echo set linesize 
^0>>C:\filename.sql. What I learnt is that I have to escape any number between 
0 to 9 (in some cases it echos set linesize to the screen leaving a blank file, 
and in some cases it echos just set linesize to the file without echoing the 
number)
But if I try to echo set linesize 10 and above to a file it works without using 
the escape character ^.. Strange.. I thought this info might be useful if 
anyone else may have to use the same to create a batch file that needs to do 
something similar..
Thanks to your offline message to me I was also able to escape % with %%.
I did manage to write a batch file that created a sql file and then used that 
sql file by calling sqlplus from within that script.
Once again thank you..
Cheers
Joe


----- Original Message ----
From: Tim Widowfield <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, June 30, 2008 9:37:02 PM
Subject: Re: Slightly OT: Creating a .sql file from a batch file

The caret is used for the escape character when you want the literal character 
instead of a special command shell reserved character (&, |, (, ), <, >, ^).  
Note that the behavior is different if you use single quotes vs. double quotes.

For example:

C:\>echo 'hi | there'
'there'' is not recognized as an internal or external command,
operable program or batch file.

C:\>echo 'hi ^| there'
'hi | there'

C:\>echo "hi | there"
"hi | there"

C:\>echo "hi ^| there"
"hi ^| there"

HTH.


--Tim



----- Original Message ----
From: Joe DeSouza <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, June 30, 2008 9:11:29 PM
Subject: [ARSLIST] Slightly OT: Creating a .sql file from a batch file

** 
I have got mostly everything working when I attempted this except for one 
obstacle I cant seem to work around..

I need to have the statement:-

select table_name|| ',' from all_tables where table_name like 'T%' and owner = 
'ARADMIN' order by table_name;

appended to a .sql file when I run a MS-DOS batch file..

I tried:-

echo select table_name|| ',' from all_tables where table_name like 'T%' and 
owner = 'ARADMIN' order by table_name;>>C:\test.sql

However DOS thinks that the statement is terminated after the first | 
character, thus it echos "select table_name to the screen and ignores the rest 
of the line..

I have tried escaping the | character with a \ but that doesn't do the trick.

Anyone has any brainwaves on how I might be able to overcome this??

Thank you

Joe




_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"

Reply via email to