- 论坛徽章:
- 0
|
如何导出oracle表中的数据为dbf或csv?
[quote]原帖由 "jzstorm"]哦?楼上的详细讲讲第二种方法:用sqlplus的方法?[/quote 发表:
desc tab_name
col
----------------------
id number
username varchar(100)
optdate date
Notice:
CSV - Comma Sperated Value
field seperates by comma(,)
execute below sql:
file unload.sql
-------------------------------
set heading off
set feedback off
set linesize 2000
set pagesize 50000
set warp off
spool c:\upload_file.csv
select '"' || id || '","' ||
username || '","' ||
to_char(optdate,'yyyymmdd hh24:mi:ss') || '"'
from tab_name;
spool off
----------------
--end of file unload.sql
Note:
the first and the last '"' = '+"+'
after you executed the unload_file.csv, use UltraEdit open it.
do Alt+T then g, the space will be trimed. |
|