Stop spool printing the sql query used (Oracle)

45,826

Solution 1

Running from within a script, set termout off works. It doesnt if you are just typing into the terminal.

create myScript.sql:

set feedback off
set pagesize 0
set termout off
spool TypeDrop.sql
select distinct 'drop type '||object_name|| ';' from user_objects where object_type='TYPE';
spool off

and from your sqlplus prompt:

SQL> @myScript

will do the trick.

Solution 2

Use sqlplus -s. The -s flag means silent

Share:
45,826
joec
Author by

joec

Student just graduated from Manchester Metropolitan University, UK with a First Class Bachelor of Science Degree in Computing (BSc(Hons) Computing). LinkedIn Pofile

Updated on June 30, 2020

Comments

  • joec
    joec almost 4 years

    I have this running in SQLplus

    set feedback off
    set pagesize 0
    spool TypeDrop.sql
    select distinct 'drop type '||object_name|| ';' from user_objects where object_type='TYPE';
    spool off
    

    It prints out to TypeDrop.sql:

    SQL> select distinct 'drop type '||object_name||';' from user_objects where object_type='TYPE';
    drop type ADDRESS_OBJTYP; 
    drop type PERSON_OBJTYP;                                                                                                                                              
    SQL> spool off
    

    How do i get it to just output the drop statements? thanks