I am using Oracle SQL Developer 2.1.1.64 to spool the results of a query to a text file Here is what I am running to call the quesry and spool the results
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
set verify off
SET ECHO OFF
spool c:\client\output_sql\t_1001_02_0522_.txt
@c:\client\queries\t_1001_02_query;
spool off
Unfortunately, i am getting
@c:\client\queries\t_1001_02_query
at the top of my output text file and I need to have just the results. I have searched the web for this and have tried a variety of things like: set verify off set termout off
Enter SPOOL with no clauses to list the current spooling status. To spool output generated by commands in a script without displaying the output on the screen, use SET TERMOUT OFF. SET TERMOUT OFF does not affect output from commands that run interactively.
To do this we use a procedure called dbms_output. put_line to place the results in a buffer that SQL*Plus will retrieve and display. SQL*Plus must be told to retrieve data from this buffer in order to display the results. The SQL*Plus command 'set serveroutput on' causes SQL*Plus to retrieve and display the buffer.
I have found that if I save my query(spool_script_file.sql) and call it using this
@c:\client\queries\spool_script_file.sql as script(F5)
My output now is just the results with out the commands at the top.
I found this solution on the oracle forums.
For Spooling in Oracle SQL Developer, here is the solution.
set heading on
set linesize 1500
set colsep '|'
set numformat 99999999999999999999
set pagesize 25000
spool E:\abc.txt
@E:\abc.sql;
spool off
The hint is :
when we spool from sql plus , then the whole query is required.
when we spool from Oracle Sql Developer , then the reference path of the query required as given in the specified example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With