Tuesday, June 10, 2008

How to spool data in Excel file?

Hi friends, sometimes we require to spool or export resultset of sql query in excel file without using third party tool. Here is very simple example of How to spool data in Excel file?
Excample:
SQL> spool c:\dept.csv
SQL> select dname || ',' || deptno from dept;

DEPTNO','DNAME
--------------------------------------------------------------------------------
10,ACCOUNTING
20,RESEARCH
30,SALES
40,OPERATIONS

SQL> spool off

Hope this will help you.

No comments: