1 Reply Latest reply: Jun 29, 2013 4:34 AM by Jim Smith RSS

    using spool to output file in SQL developer

    ANNEC

      I am using sql developer to output a csv file using spool command.

       

      It works fine in sql devleoper after I click run script, but in the output file, there are select statement in it, how to remove it:

       

      my test script is :

      set heading off

      set feedback off

      set newpage none

      set echo off

      set termout off

      set verify off

      set trimspool on

      set pause off

      set linesize 1000

      set pagesize 0

      spool /c:/csvtest/test.dat

       

      Select 'Student_Number | Last_Name' From Dual;

      Select

      student_number||'|'||last_name from students where ID in (53651,53773);

       

      Spool Off;

      Exit;

       

      But the result is: how can I remove the select statement in the output file, thanks

      > Select 'Student_Number | Last_Name' From Dual

      Student_Number | Last_Name     

       

      > Select

      student_number||'|'||last_name from students where ID in (53651,53773)

      9000000|Smith                                                                                                            

      7235435|Rodriguez                                                                                                        

        • 1. Re: using spool to output file in SQL developer
          Jim Smith

          If you open the script file in a worksheet and run it using F5 (Run Script), the SQL statement appears in the output.

           

          If you run the script file using @script the sql statement doesn't appear in the output.

           

          This corresponds to sqlplus behaviour I think, where certain set options only apply to script files, not the current buffer.

           

          Tested using SQL Developer 3.2.09.  Older versions may behave differently.