quarta-feira, 27 de agosto de 2014

Erro ORA-29913, ORA-29400, KUP-04020, ORA-06512 - found record longer than buffer size supported, 524288

Boa tarde a todos,
 
Seguem abaixo os erros que tive enquanto criava uma external table: 
 
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-29400: data cartridge error
KUP-04020: found record longer than buffer size supported, 524288,
 in C:\PathToFile\FileToLoad.txt_
ORA-06512: at "SYS.ORACLE_LOADER", line 52
 
Código que utilizei:
 
ALTER SESSION SET nls_length_semantics = CHAR
/
CREATE TABLE teste
(
    teste VARCHAR2(2000)     NULL
)
ORGANIZATION EXTERNAL
 ( TYPE ORACLE_LOADER
   DEFAULT DIRECTORY DIRETORIO
   ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
      CHARACTERSET UTF8
      STRING SIZES ARE IN CHARACTERS 
        logfile DIRETORIO:'sdp_tst_ext_%p.log'
        badfile DIRETORIO:'sdp_tst_ext_%p.bad'
        discardfile DIRETORIO:'sdp_tst_ext_%p.dsc'
        fields
    notrim
       (
             teste CHAR(2000)
           )
    )
   LOCATION ('teste_2_HOM.dat')
 )
REJECT LIMIT UNLIMITED
NOPARALLEL
NOROWDEPENDENCIES
/
 
 
Solução
 
Alterar:
RECORDS DELIMITED BY NEWLINE
 
Para:
RECORDS DELIMITED BY '\n'
 
Blog de consulta: 
http://gerardnico.com/wiki/database/oracle/external_table