I want to copy the output of unix and sqlplus into a file

oracle, plsql, sql, sqlplus, unix

Solution

Use the `SPOOL` command:

SQL> SPOOL /opt/output

SQL> SELECT ...

SQL> SPOOL OFF

Problem

I am using Solaris. I have to log into sql plus and run some queries, which give a huge result set. I want to copy all that into a file. Is there any command for it in unix or sqlplus ?

Original source