Try doubling the %

 

i.e. T% becomes T%%

 

--- J.T. Shyman

  _____  

From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Joe DeSouza
Sent: Tuesday, July 01, 2008 1:25 PM
To: [email protected]
Subject: Re: Slightly OT: Creating a .sql file from a batch file

 

Tim,

 

Sorry for bothering you again but I'm wondering if you have a solution for
this..

 

When I put the same statement below in a batch file, it wont work like it
does from the command prompt.. The reason being everything after the % sign
right upto the first : is treated as a variable declaration.

 

So when a statement

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

is in a batch file, what gets echoed to the file is  

select table_name|| ',' from all_tables where table_name like 'T\test.sql

 

This I guess is because the part

%' and owner = 'ARADMIN' order by table_name;>>C

gets treated as a variable declartion..

 

So instead of using % I used * and echoed the following to the file..

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

 

So now I get the statement

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

echoed to the file test.sql

 

Obviously now I would need to use some command in the batch file to open the
file and replace all instances of * with %

 

I tried using the DOS edlin editor but can't figure its syntax from the
command line.. I did google and it and this is the only page I found but
couldn't still figure it out..

http://www.computerhope.com/edlin.htm#04

 

See the Syntax section -> {RANGE] R {STRING1] [STRING2]

 

Can't really seem to figure out how to get that working..

 

Any suggestions?

 

Joe

 

----- Original Message ----
From: Tim Widowfield <[EMAIL PROTECTED]>
To: Joe DeSouza <[EMAIL PROTECTED]>
Sent: Monday, June 30, 2008 9:42:22 PM
Subject: Re: [ARSLIST] Slightly OT: Creating a .sql file from a batch file

I think you just need double quotes around the whole statement, despite my
earlier email about using a caret.

 

Tim Widowfield
m: 319-651-2964
v: 319-550-5547 

 

----- 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


__Platinum Sponsor: www.rmsportal.com <http://www.rmsportal.com/>  ARSlist:
"Where the Answers Are" html___

 

__Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
html___

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

Reply via email to