Oracle SQLPlus Query Output to a File

| Posted by watashii | Filed under Database, Programming, Unix

Here is a simple way to output SQL query output into a file, via command line based SQLPlus.

Step 1: Nominate the output file location. In this case this is a Unix location.

SQL> spool /tmp/output.txt

Step 2: Perform your SQL query.

SQL> select * from tab;

Step 3: Close the file.

SQL> spool off

Tip: Use set lines statement to adjust output display

Read the rest of this entry »

Tags: , , , ,