Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

External Table - Issue with New line characters in csv.

MKDec 26 2011 — edited Dec 26 2011
Hi All,
We have new line characters in the csv that we want to load to an Oracle table. Hence, we had used 'replace' function in the control file of sql loader. However oracle external table is not allowing me to use 'replace' function while creating the table. I'm using 11g, please suggest a solution.

Regards,
KK

External table script whih is giving issues:
CREATE TABLE ikncu.cont_ext (
  CONTACTID  CHAR      %REPLACE(:CONTACTID,CHR(13)||CHR(10),' ')%

)
ORGANIZATION EXTERNAL (
  TYPE              oracle_loader
  DEFAULT DIRECTORY timezdif_dir
  ACCESS PARAMETERS (
    RECORDS DELIMITED  BY NEWLINE
    FIELDS  TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'

    MISSING FIELD VALUES ARE NULL
  
  )
  LOCATION ('file.csv')
)
REJECT LIMIT UNLIMITED;
{code}

Sql loader control file sample.
{code}
LOAD DATA
APPEND
INTO TABLE my table
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
TRAILING NULLCOLS
(
CONTACTID                      CHAR      %REPLACE(:CONTACTID,CHR(13)||CHR(10),' ')%,
ACCOUNT_NAME                   CHAR      %REPLACE(:ACCOUNT_NAME,CHR(13)||CHR(10),' ')%

)" |tr '\%' '\"' >my_control_file.ctl
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 23 2012
Added on Dec 26 2011
6 comments
5,304 views