简体   繁体   中英

not able to export table into csv format

I am trying to export table into csv format as below:

SQL> desc test;


Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DN                                                 NUMBER(10)
 DISCONNECT_DATE                                    DATE

SQL> select DN ,DISCONNECT_DATE from test into OUTFILE '/tmp/data.csv';
select DN ,DISCONNECT_DATE from test into OUTFILE '/tmp/data.csv'
                                      *

ERROR at line 1: ORA-00933: SQL command not properly ended

could you please anyone help me to resolved above problem.

I got the answer if we are using sql plus then we need use spool to get data into csv format. Below is the steps...(don't forget to spool off after execution of query. )

SQL> set colsep ,
SQL> set headsep off
SQL> set pagesize 0
SQL> set trimspool on
SQL> spool /tmp/data.csv
SQL> select * from test;
-----------------(we cant placed the data)
10 rows selected.

SQL> spool off

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM