DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Tuesday, April 25, 2017

Oracle database 12cR2 New Feature -Spool CSV

Oracle database 12CR2 New Feature -Spool CSV
****************************************

Syntax

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

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

SQL> conn system/oracle@orclpdb
Connected.

SQL> select ename,job from emp where rownum < 10;

ENAME   JOB
---------- ---------
KING   PRESIDENT
BLAKE   MANAGER
CLARK   MANAGER
JONES   MANAGER
SCOTT   ANALYST
FORD   ANALYST
SMITH   CLERK
ALLEN   SALESMAN
WARD   SALESMAN

9 rows selected.

New CSV Format.

SQL> SET MARKUP CSV ON

SQL> select ename,job from emp where rownum < 10;

"ENAME","JOB"
"KING","PRESIDENT"
"BLAKE","MANAGER"
"CLARK","MANAGER"
"JONES","MANAGER"
"SCOTT","ANALYST"
"FORD","ANALYST"
"SMITH","CLERK"
"ALLEN","SALESMAN"
"WARD","SALESMAN"

9 rows selected.


So Now in 12.2 you can spool as csv and open in excel sheet

No comments: