>  기사  >  데이터 베이스  >  sqlplus 技巧 spool 指定格式的文件

sqlplus 技巧 spool 指定格式的文件

WBOY
WBOY원래의
2016-06-07 15:23:531231검색

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 sqlplus的技巧实在是多,以后慢慢总结了。 SQL column F new_val F SQL select to_char(sysdate,'yyyymmddhh24miss')||'.txt' F from dual; F ------------------ 20050124174926.txt SQL spool F C

欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入

sqlplus的技巧实在是多,以后慢慢总结了。

SQL> column F new_val F
SQL> select to_char(sysdate,'yyyymmddhh24miss')||'.txt' F from dual;

F
------------------
20050124174926.txt

SQL> spool &F

Connected to:
Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
With the Partitioning option
JServer Release 8.1.7.0.0 - Production

SQL> column F new_val F
SQL> select to_char(sysdate,'yyyymmddhh24miss')||'.txt' F from dual;

F
------------------
20050124174926.txt

SQL> spool &F
SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
EMP                            TABLE
FK1                            TABLE
HASHTAB                        TABLE
HASHTAB5                       TABLE
HASHTABLE                      TABLE
HASHTABT                       TABLE
MLOG$_T                        TABLE
MLOG$_T_MASTER                 TABLE
OB                             TABLE
PK1                            TABLE
PLAN_TABLE                     TABLE

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
RUPD$_T                        TABLE
RUPD$_T_MASTER                 TABLE
T                              TABLE
TCAAA                          TABLE
TESTLONG                       TABLE
TESTLONG2                      TABLE
TRAN                           TABLE
TTTT                           TABLE
T_MASTER                       TABLE
VVV                            TABLE

21 rows selected.

SQL> spool off
SQL> host type &F
SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID

------------------------------ ------- ----------

EMP                            TABLE

FK1                            TABLE

HASHTAB                        TABLE

HASHTAB5                       TABLE

HASHTABLE                      TABLE

HASHTABT                       TABLE

MLOG$_T                        TABLE

MLOG$_T_MASTER                 TABLE

OB                             TABLE

PK1                            TABLE

PLAN_TABLE                     TABLE


TNAME                          TABTYPE  CLUSTERID

------------------------------ ------- ----------

RUPD$_T                        TABLE

RUPD$_T_MASTER                 TABLE

T                              TABLE

TCAAA                          TABLE

TESTLONG                       TABLE

TESTLONG2                      TABLE

TRAN                           TABLE

TTTT                           TABLE

T_MASTER                       TABLE

VVV                            TABLE

21 rows selected.

SQL> spool off

SQL>

sqlplus 技巧 spool 指定格式的文件

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.