Oracle SqlPlus - saving output in a file but don't show on screen

前端 未结 4 1370

Using SqlPlus for Oracle, how do I save the output of a query in a file but not show it on the terminal/prompt.

相关标签:
4条回答
  • 2021-01-01 09:34

    Try this:

    SET TERMOUT OFF; 
    spool M:\Documents\test;
    select * from employees;
    /
    spool off;
    
    0 讨论(0)
  • 2021-01-01 09:34

    set termout off doesn't work from the command line, so create a file e.g. termout_off.sql containing the line:

    set termout off
    

    and call this from the SQL prompt:

    SQL> @termout_off
    
    0 讨论(0)
  • 2021-01-01 09:35

    Right from the SQL*Plus manual
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch8.htm#sthref1597

    SET TERMOUT

    SET TERMOUT OFF suppresses the display so that you can spool output from a script without seeing it on the screen.

    If both spooling to file and writing to terminal are not required, use SET TERMOUT OFF in >SQL scripts to disable terminal output.

    SET TERMOUT is not supported in iSQL*Plus

    0 讨论(0)
  • 2021-01-01 09:44

    Try This:

    sqlplus -s ${ORA_CONN_STR} <<EOF >/dev/null
    
    0 讨论(0)
提交回复
热议问题