Now we can spool spool CSV or JSON from Oracle Database. Prior to 12.2 , we can spool as text or html, but from 12.2 onward, the SET MARKUP command now has a CSV option to output data in CSV format.

Syntax

CSV {ON|OFF} [DELIMI[TER] character] [QUOTE {ON|OFF}]

Traditionally you wiill get formatted output (without CSV)  as below.

Now run it with the new CSV Format.

The following example illustrates how to extract all records from the Employee table of the database, with text strings unquoted and with different delimiter.

So Now in 12.2 you can spool as csv and open in excel sheet. You can see the delimiter can be changed from a comma, and quoting of fields can be disabled.

Leave a Reply