Requirement: select * from dual to be executed; and the content of retrieval is in the customized file d:\test.txt.
Practice:
- win+R enter cmd to call up the command window
- sqlplus connects to the database "sqlplus username/password@ip:port number/service name"
- spool d:\test.txt
- Implementation such as: select * from dual;
- spool off
Example
set head off
set trimspool on
set pagesize 0
set linesize 1000
set termout off
set feedback off
set arraysize 30
set feedback off
set echo off
spool C:\Users\lianhong.li\Desktop\test\test.csv
select * from T_REWARD_COMMISSION_1212;
spool off