I am trying to create a batch file for windows (XP) which will have several sqls and when its run it would 1. connect with oracle 2. set the userid/password/schema 3. run each sql in the loop and 4. output each sql outputs to its own flat file.
I have started the script
@ECHO off
SET STATE=fl
TABLE1=AGENCY
set SQL1="SELECT Column_ID||CHR(31)||column_ENTITY_CD||CHR(31) FROM AGENCY"
set TABLE2=FIRM
set SQL2="SELECT Column_ID||CHR(31)||Column_NM||CHR(31) FROM FIRM"
set TABLE3=FL_CO_LOB
Set SQL3="SELECT Column_ID||CHR(31)||Column_LOB_CODE||CHR(31) FROM FL_CO_LOB"
...
SET NumberOfTables=19
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /l %%A IN (1,1,%NumberOfTables%) DO (
echo !SQL%%A!
)
endlocal
I can get the SQL out of the variable but don't have any clue how to connect to oracle and run the sql and get the output to a defined file.
please give me some direction.
one thing to notice that the echo is printing including the double quote. but If i don't have them then it just print the 1st word not the whole query.
Thanks