I want to execute query from batch file and put exact output of query into csv file. Like: my query is : select sysdate from dual. Output of this :
Sysdate
23-feb-2013
So, in csv it stored as
sysdate
22-feb-2013
DB: Oracle 11g OS: windows 7
Kindly plz help me to achieve this ..
c:\myfolder\mybatch.bat:
call sqlplus oracleuser/oraclepwd@oracledb @c:\myfolder\myquery.sql
c:\myfolder\myquery.sql:
set head off
set feed off
set pagesize 0
spool c:\myfolder\myresult.csv
prompt sysdate
select to_char(sysdate, 'dd-mon-yyyy') from dual;
spool off
set head on
set feed 6
quit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With