【匯入匯出】sqlldr 匯入含有內嵌換行符的資料

楊奇龍發表於2011-03-10
如何載入含有內嵌換行符的資料,這裡使用了使用非換行符的chr(10)來代替換行符,在載入資料時使用一個sql函式來完成該任務。
load data
infile *
into table dept
append
fields terminated by  ','
trailing nullcols
( deptno,
  dname,
  loc,
  comments "replace(:comments,'\\n',chr(10))"---注意函式的用法
 )
begindata
10,sales,hangzhou,this is the sales\noffice in hz
20,consulting,hangzhou,this is the consulting\noffice in hz
30,accounting,hangzhou,this is the accounting\noffice in hz
40,finance,hangzhou,this is the finance\noffice in hz
查詢驗證。
yang@ORACL> col comments for a50
yang@ORACL> select * from dept;

    DEPTNO DNAME          LOC           COMMENTS
---------- -------------- ------------- --------------------------------------------------
        10 sales          hangzhou      this is the sales
                                         office in hz
        20 consulting     hangzhou      this is the consulting
                                         office in hz
        30 accounting     hangzhou      this is the accounting
                                         office in hz
        40 finance        hangzhou      this is the finance
                                         office in hz

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-688900/,如需轉載,請註明出處,否則將追究法律責任。

相關文章