I want to create a batch file which will open the SQLPLUS [CLI] and will execute some stored sql file and will also store the output to text file.
So I've created this batch file [which does not work].
These SQL file contains SQL which returns the max number from a table.
sqlplus scott/tiger@DB
@sql1.sql>data1.txt
@sql2.sql>data2.txt
The problem is it does not executes the SQL files after opening the SQLPLUS
What about native Sql*plus spooling?
run.bat:
sqlplus hr/hr@sandbox @d:\run.sql
run.sql:
spool d:\run.log
set echo on
select * from dual
/
exit
run.log:
01:50:20 HR@sandbox>
01:50:20 HR@sandbox> select * from dual
01:50:20 2 /
D
-
X
Elapsed: 00:00:00.00
01:50:21 HR@sandbox> exit