Spool result to a text file : spool « SQL PLUS Session Environment « Oracle PL/SQL Tutorial






SQL>
SQL> set heading off
SQL> set feedback off
SQL>
SQL> spool c:\ALIASES.TXT
SQL>
SQL> select object_name || '=' || substr(object_name,1,5) from user_objects wher
e object_type = 'TABLE';



MYSTATS=MYSTA
WORKING_CUSTOMERS=WORKI
CUST_WITH_VARRAY_TEMP_TABLE=CUST_
P1=P1
IT=IT
CUST_NO_KEY_TABLE=CUST_
DEMO=DEMO
P=P
CUSTLOG=CUSTL
IX=IX
EMP_DELTAS=EMP_D
PARMS=PARMS
PASSWORD_AUDIT=PASSW
DEPT$AUDIT=DEPT$
INVENTORY_TBL=INVEN
TMP=TMP
EMPLOYEETEMPTABLE=EMPLO
SYSTEM_STATS=SYSTE
TEMP_TABLE=TEMP_
MYTABLE1=MYTAB
C1=C1
WORKING_EMPLOYEES=WORKI





SQL>
SQL> spool off
SQL> set heading on
SQL> set feedback on
SQL>








29.55.spool
29.55.1.Use Spoll to save query to a file
29.55.2.Spool to a file with compute
29.55.3.Spool result to a text file
29.55.4.Extracts data from the emp table and writes it to a text file in a comma-delimited format