Thursday, April 26, 2012

How to: Save PL/SQL query results to text file

The my solution is very simple, without use of often suggested on forums solutions based on UTL_FILE package. To solve this problem I simply used the database spool functionality. Please check out code cited below:

SET ECHO OFF FEEDBACK OFF;
SET COLSEP ',';
SPOOL c:/oracle/myOutputFile.txt;
SELECT samaccname,nextcolumn from mytable where samaccname is not null;
SPOOL OFF;

No comments:

Post a Comment