在使用sqlplus導出csv文件時,如果標題行中存在空格,可以使用以下方法解決:
SELECT column_name AS "First Name", other_column AS "Last Name"
FROM table_name;
SET COLSEP ','
SET HEADING ON
SET FEEDBACK OFF
SET PAGESIZE 0
SET LINESIZE 1000
SPOOL file_path.csv
SELECT column_name AS "First Name", other_column AS "Last Name"
FROM table_name;
SPOOL OFF
這樣就可以確保標題行中的空格會被正確導出到csv文件中。