I have a batch files which when i run calls a SQL file. This SQL file prompts user to input data which I store in MYPeriod( this accepts date as input ).the output of SQL file is a CSV file. Here is my code for SQL file:
PROMPT Enter a period
ACCEPT MYPeriod PROMPT 'Period: '
SET LINESIZE 500 FEEDBACK OFF TRIMSPOOL ON TERMOUT OFF HEAD OFF PAGESIZE 0 TERM OFF
spool E:\abc\Test\File1_&MYPeriod.csv
select Account || ',' || Membername || ',' || GROUP || ',' || FUTURE1 from ACTUAL_V@UAT1_Test where Key=21 and period_name= '&MYPeriod' ;
spool off
exit
My queries :
When I run this , a file gets generated in location E:\abc\Test with a name File1_12-2012csv.Lst. I want a csv file . If i hard code the file name(replace &MYPeriod by test) File1_Test.csv gets generated perfectly.Why the code is not able to create file with the name user has input..?
The output of this creates a csv file and retrieves the accounts from db but it prints two extra line at top. The new query and old query. How do I redefine my code, so that it gets remove automatically.
Appreciate your help guys.