본문 바로가기

DB/__Oracle

SQLPLUS - SPOOL

spool on 또는 spool path+파일명
->이렇게 하면 쿼리 결과를 파일로 저장할 수 있죠.
SQL> spool on
SQL> select * from product_component_version;
NLSRTL                         3.4.1.0.0       Production
Oracle8i Enterprise Edition    8.1.7.4.0       Production
PL/SQL                         8.1.7.4.0       Production
TNS for HPUX:                  8.1.7.4.0       Production
SQL> spool off
SQL> !ls
LOCK          TOOL          app           jre           nohup.out     oui           tempwork
STC           admin         doc           led.sh        on.lst        script        test.sql
Script        afiedt.buf    hiraScript    led_test.sql  oraInventory  temp.sql
SQL> !vi on.lst
"on.lst" 8 lines, 387 characters
SQL> select * from product_component_version;
NLSRTL                         3.4.1.0.0       Production
Oracle8i Enterprise Edition    8.1.7.4.0       Production
PL/SQL                         8.1.7.4.0       Production
TNS for HPUX:                  8.1.7.4.0       Production
SQL> spool off