Sunday, December 23, 2012

Spooling in SQL



SPOOL

This will record the data when you spool on, upto when you say spool off. By default it will give lst as extension.
Syntax:
            Spool on | off | out | <file_name>.[Extension]
Ex:
            SQL> spool on
SQL> select * from dept;


DEPTNO DNAME            LOC
--------- --------------   ----------
    10      ACCOUNTING  NEW YORK
    20      RESEARCH       DALLAS
    30      SALES              CHICAGO
    40      OPERATIONS   BOSTON

SQL> spool off
SQL> ed on.lst

SQL> select * from dept;

DEPTNO DNAME            LOC
--------- --------------   ----------
    10      ACCOUNTING  NEW YORK
    20      RESEARCH       DALLAS
    30      SALES              CHICAGO
    40      OPERATIONS   BOSTON

SQL> spool off

No comments:

Post a Comment