oracle query output in excel file
Code:
SQL> spool emp.xls SQL> select empno||chr(9)||ename||chr(9)||job||chr(9)||mgr from emp; SQL> spool off
Code:
SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF ; SPOOL MY_TEST_FILE.xls; SELECT * FROM EMP; SPOOL OFF;
Code:
set heading off pages 0 trimspool on feedback off echo off spool c:\emp.xls select 'EMPNO'||chr(9)||'ENAME'||chr(9)||'JOB'||chr(9)||'MGR' from dual union all select empno||chr(9)||ename||chr(9)||job||chr(9)||mgr from emp; spool off
Then, from the SQL prompt:
Code:
test@ORA10G> test@ORA10G> host type c:\test.sql set heading off pages 0 trimspool on feedback off echo off spool c:\emp.xls select 'EMPNO'||chr(9)||'ENAME'||chr(9)||'JOB'||chr(9)||'MGR' from dual union all select empno||chr(9)||ename||chr(9)||job||chr(9)||mgr from emp; spool off test@ORA10G> test@ORA10G> @c:\test.sql EMPNO ENAME JOB MGR 7369 SMITH CLERK 7902 7499 ALLEN SALESMAN 7698 7521 WARD SALESMAN 7698 7566 JONES MANAGER 7839 7654 MARTIN SALESMAN 7698 7698 BLAKE MANAGER 7839 7782 CLARK MANAGER 7839 7788 SCOTT ANALYST 7566 7839 KING PRESIDENT 7844 TURNER SALESMAN 7698 7876 ADAMS CLERK 7788 7900 JAMES CLERK 7698 7902 FORD ANALYST 7566 7934 MILLER CLERK 7782 test@ORA10G>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-709490/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [GAUSS-51808] : The env file contains errmsg: {'Node[192.168.56.181]': 'Output:AI
- ORACLE Flashback Query偽列Oracle
- C# read excel file via ExcelDataReaderC#ExcelLDA
- Warning: Cannot modify header information - headers already sent by (output started at file_path:line)HeaderORM
- Oracle:db file scattered readOracle
- Oracle閃回技術--Flashback Version QueryOracle
- Oracle ASM Cluster File Systems (ACOracleASM
- Oracle 12C Database File Mapping for Oracle ASM FilesOracleDatabaseAPPASM
- Oracle 18.3 Resize operation completed for file#Oracle
- 2Gb - File limits in Oracle(轉)MITOracle
- Structured OutputStruct
- oracle 匯出excel 格式整改OracleExcel
- Oracle 資料匯入ExcelOracleExcel
- 安裝win10系統提示Output error file to the following location A:\ghosterr.txt怎麼辦Win10Error
- kettle從入門到精通 第五十六課 ETL之kettle Microsoft Excel OutputROSExcel
- [20220128]Check the datapump file header information in Oracle.txtHeaderORMOracle
- ORACLE opatch 打補丁fuser command output for /u01/.../crsctl.bin is FailureOracleAI
- diff output understanding
- oracle ORA-01157: cannot identify/lock data file 64OracleIDE
- 【STACKX】Oracle core file分析利器STACKX 使用指南Oracle
- Oracle RAC+DG 調整redo/standby log fileOracle
- angular input和outputAngular
- DML_The OUTPUT Clause
- oracle 匯入報錯:field in data file exceeds maximum lengthOracle
- Oracle RAC 重置db_recovery_file_dest_size引數Oracle
- 【TUNE_ORACLE】等待事件之日誌等待“log file sync”Oracle事件
- 使用Oracle SQL Developer匯入Excel資料OracleSQLDeveloperExcel
- HTML <output> 輸出域HTML
- OpenVINO(get_output_tensor())
- 【TUNE_ORACLE】等待事件之日誌等待“log file parallel write”Oracle事件Parallel
- 【ASM】Oracle RAC css啟動報錯"Duplicate voting file found"ASMOracleCSS
- 【TUNE_ORACLE】等待事件之IO等待“db file scattered read”Oracle事件
- 【TUNE_ORACLE】等待事件之IO等待“db file sequential read”Oracle事件
- 【TUNE_ORACLE】等待事件之IO等待“db file parallel write”Oracle事件Parallel
- reg query /?
- Query DSL
- ES 筆記十:Query String & Simple Query String筆記
- Oracle啟動報錯:ORA-03113: end-of-file on communication channelOracle
- oracle12.2 adg ORA-46952: standby database format mismatch for password fileOracleDatabaseORM