将下列内容保存成一个.bat文件,运行即可
echo alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'; >test.sql
echo SET ECHO OFF NEWPAGE 0 SPACE 0 >> test.sqlecho set heading off >>test.sql
echo set linesize 10000 >>test.sql
echo set pagesize 0 >>test.sql
echo set trimspool ON >>test.sql
echo set termout off >>test.sql
echo set feedback off >>test.sql
echo SPOOL D:\WORK_DOC\bank\CHARTSQL\%date:~0,4%%date:~5,2%%date:~8,2%.TXT >>test.sql
echo SELECT a.* from sym_tap_autochart_chart a >>test.sql
echo order by 2,3 >>test.sql
echo ; >>test.sql
echo SELECT CHARTNO||' : '||to_char(a.v_sql) from sym_tap_autochart_chart a
echo WHERE A.CHARTNO LIKE '%B%' >>test.sql
echo where a.n_batch_no IN ( '22') >>test.sql
echo ; >>test.sql
echo SPOOL OFF >>test.sql
echo exit >>test.sql
sqlplus 用户名/密码@IP:PORT/ORCL @test.SQL