WEB开发网
开发学院数据库Oracle sqlplus 技巧 spool 指定格式的文件 阅读

sqlplus 技巧 spool 指定格式的文件

 2008-12-17 13:06:29 来源:WEB开发网   
核心提示:sqlplus的技巧实在是多,以后慢慢总结了,sqlplus 技巧 spool 指定格式的文件,SQL> column F new_val FSQL> select to_char(sysdate,'yyyymmddhh24miss')||'.txt' F from dual

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>

Tags:sqlplus 技巧 spool

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接