How to spool a file in SQL? What is the purpose of spooling a file?

I would like to know the correct method in spooling. I am new in SQL.

1 Answer

Relevance
  • 1 decade ago
    Best Answer

    Well spooling isn't really inherent to SQL itself but more towards SQL products like Oracle's SQL Plus. Spooling takes the results of SQL commands and dumps it to an output device like a file or printer. The original ideal of spool was putting the data in a memory location queue so that a device can have access to it when it is finally ready... a print queue is a type of spool.

    In SQL Plus the command is....

    SQL>spool <filename> [mode]

    Example would be...

    SQL>spool my_results.log;

    SQL>....various SQL commands...

    SQL>spool off;

    Using the mode (for things like appending)...

    SQL>spool my_results.log APPEND;

    SQL>....some more various SQL commands...

    SQL>spool off;

    Hope this is the information you were looking for.

    Enjoy!

Still have questions? Get your answers by asking now.