SKIP option in External Table

Hi,
I would like to skip the first row in the external table.
I used the SKIP option.
The tabl create succsessfully - But for some reason i am getting an error related to the skip option when select from the table.
Could you please tell me what missing/wrong with the syntax ?
SQL> CREATE TABLE ext_tab (
  2  ITEM                VARCHAR2(100),
  3  MODEL               VARCHAR2(100),
  4  packing_no          VARCHAR2(100),
  5  ship_date           VARCHAR2(100),
  6  Internal_SN         VARCHAR2(100),
  7  SHIPPING_SN         VARCHAR2(100),
  8  MACID               VARCHAR2(100),
  9  CARTON_NO           VARCHAR2(100),
10  PALLET_ID           VARCHAR2(100),     
11  PO                  VARCHAR2(100),
12  KEY                 VARCHAR2(100),
13  PASSWORD_TR         VARCHAR2(100),
14  PASSWORD_ADMIN      VARCHAR2(100))
15  ORGANIZATION EXTERNAL
16  (TYPE oracle_loader
17  DEFAULT DIRECTORY TMP_DIR
18  ACCESS PARAMETERS
19  (FIELDS TERMINATED BY ','
20  SKIP 1
21  MISSING FIELD VALUES ARE NULL
22  (ITEM,MODEL,packing_no,SHIP_DATE,Internal_SN,SHIPPING_SN,MACID,CARTON_NO,PALLET_ID,PO,KEY,PASSWORD_TR,PASSWORD_ADMIN)) 
23  LOCATION ('SN.csv'))
24  PARALLEL
25  REJECT LIMIT 0;
Table created.
SQL> select * from ext_tab;
select * from ext_tab
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "skip": expecting one of: "column, enclosed, exit, (, ltrim, lrtrim, ldrtrim, missing, notrim, optionally, rtrim, reject"
KUP-01007: at line 2 column 1
ORA-06512: at "SYS.ORACLE_LOADER", line 19

Hi,
Kindly find below the syntax for creating the external table
Line: -----
CREATE TABLE <table_name> (
<column_definitions>)
ORGANIZATION EXTERNAL
(TYPE oracle_loader
DEFAULT DIRECTORY <oracle_directory_object_name>
ACCESS PARAMETERS (
RECORDS DELIMITED BY newline
BADFILE <file_name>
DISCARDFILE <file_name>
LOGFILE <file_name>
[READSIZE <bytes>]
[SKIP <number_of_rows>
FIELDS TERMINATED BY '<terminator>'
REJECT ROWS WITH ALL NULL FIELDS
MISSING FIELD VALUES ARE NULL
(<column_name_list>))\
LOCATION ('<file_name>'))
[PARALLEL]
REJECT LIMIT <UNLIMITED | integer>;
Line: -----
Please note that the order of the items in the ACCESS PARAMETERS differs in your Create Table syntax. Also check whether the .CSV file is available in the TMP_DIR directory path.
Regards,
Sandhya G.

Similar Messages

  • Skipping header in external table...

    Is it possible to define an external table within OWB to skip the first few rows of a file? I haven't been able to find anything in the configuration of an external table that allows you to skip lines.
    If it is not available, will it be be added to OWB in the future?
    I am running OWB 9.2.0.2.8
    Thanks

    I think I have found a bug in OWB. I keep losing the number of rows to skip in external tables.
    I defined a File to skip the first three rows then created an external table based on the File. When I deployed the external table, "SKIP 3" was generated. Later, I made some configuration changes to the external table (setup a BAD file/location, set it to trim the fields, load Nulls, etc). When I redeployed the external table, "SKIP 3" was missing.
    Then I did an MDL export of the File. In the MDL file, "SkipRecords" was 0. I changed it to 3, and then imported the MDL back into OWB (match by UOID, replace existing). Then when I redeployed the external table, "SKIP 3" was back in the definition.
    Is this a known issue? Is it fixed in the latest version? I am using OWB 9.2.0.2.8.
    Thanks!

  • Skip lines on external tables

    Hello,
    Would it be possible to skip specific lines ? By exemple I don't want line 107, 206 and 455.
    Thanks for your answer !

    BLANKS as null value or BLANKS as a character string ?
    You can do it as :
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "LOADER" ACCESS PARAMETERS (
    RECORDS DELIMITED BY newline Skip 1 FIELDS TERMINATED BY 0X'09'
    LOAD WHEN (CODE != 'BLANKS')
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS
    WITH
    ALL NULL
    FIELDS (Emp_id, Last_name, First_name, Adr_1, Adr_2, CODE, CITY) ) LOCATION ( 'Emp.tsv' )
    )or
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "LOADER" ACCESS PARAMETERS (
    RECORDS DELIMITED BY newline Skip 1 FIELDS TERMINATED BY 0X'09'
    LOAD WHEN (CODE is not null)
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS
    WITH
    ALL NULL
    FIELDS (Emp_id, Last_name, First_name, Adr_1, Adr_2, CODE, CITY) ) LOCATION ( 'Emp.tsv' )
    )

  • External Table Skip Row

    I've created external table, but how do I get the external table to skip the header and footer?
    CREATE TABLE "KAS_EXT"
    CUSTOMERID VARCHAR2(9),
    CANVASSID VARCHAR2(9),
    REPID VARCHAR2(9)
    ORGANIZATION external
    TYPE oracle_loader
    DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
    ACCESS PARAMETERS
    RECORDS DELIMITED BY NEWLINE CHARACTERSET WE8MSWIN1252
    BADFILE 'kaslist_ext_devt_water.bad'
    LOGFILE 'kaslist_ext_devt_water.log_xt'
    READSIZE 1048576
    FIELDS TERMINATED BY "," LDRTRIM
    MISSING FIELD VALUES ARE NULL
    SKIP 1 <<<<<<<<<<<<<<< here???
    REJECT ROWS WITH ALL NULL FIELDS
    CUSTOMERID CHAR(255)
    TERMINATED BY ",",
    CANVASSID CHAR(255)
    TERMINATED BY ",",
    REPID CHAR(255)
    TERMINATED BY ","
    location
    'kas.csv'
    )REJECT LIMIT UNLIMITED

    I don't know of any way to make it automatically skip footers. Hopefully, the footer doesn't match your data structure, so that it couldn't get loaded as a record, then it would just go to your bad file.

  • EXTERNAL TABLE SKIP HEADER :::THANKS

    Hi Everybody,
    How can I skip header in a csv File using an external table definition ,
    Thanks,
    W

    Did you try SKIP?
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652/ch12.htm#1009462

  • Issues with external table from excel file

    dear all,
    i have been trying to use the below statement to create an external table.this table is referencing an excel file.
    CREATE TABLE EMPFRAUD_TEST
    SERIAL_NUM VARCHAR2(10 BYTE),
    BRANCH_CODE VARCHAR2(10 BYTE),
    BUSINESS_ADD VARCHAR2(100 BYTE),
    REGIONS VARCHAR2(50 BYTE),
    TRANSACTION_DATE_TIME DATE,
    REPORT_DATE_TIME DATE,
    NO_OF_TRANS VARCHAR2(4 BYTE),
    AMOUNT NUMBER,
    FRAUD_TYPE VARCHAR2(25 BYTE),
    IMPACT_CATEGORY VARCHAR2(10 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY EXT_EMP_TEST
    ACCESS PARAMETERS
    ( records delimited by newline
    badfile 'empfraud%a.bad'
    logfile 'empfraud%a.log'
    fields terminated by ','
    optionally enclosed by '"'lrtrim
    missing field values are null
    LOCATION ('fraud.csv')
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    the problems is as follows
    1) when i run the query above the table will be created,
    but when i try to select from the table,an empty table will be display.
    when i checked the error log file,the following message was given.
    it was gotten from an oracle db on unix server.
    "L_NUM
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 71 rejected in file /home/oracle/ext_folder_test/fraud.csv
    KUP-04021: field formatting error for field ACCOUNT_KEY
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 79 rejected in file /home/oracle/ext_folder_test/fraud.csv
    KUP-04021: field formatting error for field SERIAL_NUM
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 80 rejected in file /home/oracle/ext_folder_test/fraud.csv
    error processing column TRANSACTION_DATE_TIME in row 1 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column TRANSACTION_DATE_TIME in row 2 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 3 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 8 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 9 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 10 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 11 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01858: a non-numeric character was found where a numeric was expected
    error processing column TRANSACTION_DATE_TIME in row 12 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 13 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 14 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month
    error processing column TRANSACTION_DATE_TIME in row 15 for datafile /home/oracle/ext_folder_test/fraud.csv
    ORA-01843: not a valid month"
    pls i need help to resolve it fast
    thank
    regards
    ajani abdulrahman olayide
    NB:
    after conversion to .csv format,
    BELOW IS THE DATA I AM TRYING TO ACCESS FROM THE EXCEL FILE
    BUSINESS OFFICE,REGIONS,Transaction_Date_Time,Report_Date_Time,Account_Key (Account No),     Number_of_Transactions,Total_Amount (N)      
    1,162,9 ojo street,Lagos South,various ,17/01/10,16200388749987,1,5100000,CHEQUE
    2,0238,"10 cyril Road, Enugu",East,21/06/2006,23/12/10,020968765357 09867653920174,1,20000000
    3,0127,"261, obiageli Rd, Asaba",Mid-West,22/12/2010,23/12/10,'00160030006149,1,6000000
    4,0519,"just road, Onitsha
    ",East,12/03/2010,14/02/11,0896002416575,1,5000000
    5,0519,"just road, Onitsha
    ",East,03/12/2010,14/02/11,06437890134356,1,5000000
    6,149,olayide street,Lagos South,10/02/2010,17/02/11,NGN01492501036 ,1,6108950
    7,0066,wale,Mid - west,18/02/2011,18/02/10,'05590020002924,1,55157977.53
    8,66,john,Mid- west,11/03/2010,14/03/09,'00660680054177,1,6787500
    9,0273,waheed Biem,N/Central,Jan 09 to Dec 2010,01/04/11,Nil,1,14146040

    As others suggested, you have to do the debugging yourself, To avoid the date error you may need something like this:
    CREATE TABLE EMPFRAUD_TEST
        SERIAL_NUM   VARCHAR2(10),
        BRANCH_CODE  VARCHAR2(10),
        BUSINESS_ADD VARCHAR2(100),
        REGIONS      VARCHAR2(50),
        TRANSACTION_DATE_TIME DATE ,
        REPORT_DATE_TIME DATE ,
        NO_OF_TRANS     VARCHAR2(50),
        AMOUNT          NUMBER,
        FRAUD_TYPE      VARCHAR2(25),
        IMPACT_CATEGORY VARCHAR2(10)
      ORGANIZATION EXTERNAL
        type oracle_loader default directory saubhik
        access parameters
        ( records delimited by newline
          badfile 'empfraud%a.bad'
          logfile 'empfraud%a.log'
          skip 1
          fields terminated by ','
          optionally enclosed by '"' ltrim
          missing field values are null
           ( serial_num ,
             branch_code ,
            business_add ,
            regions ,
            transaction_date_time date "dd/mm/rrrr",
            report_date_time date "dd/mm/rr",
            no_of_trans ,
            amount ,
            FRAUD_TYPE ,
            IMPACT_CATEGORY ) ) LOCATION ('fraud.csv')
      REJECT LIMIT UNLIMITED
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • A special character in the last column in my external table

    Hello,
    I'v made a external table that looks like this :
    CREATE
    TABLE "REC_XLS"
    "FINANCE_DATE" VARCHAR2(50 BYTE),
    "CREATION_DATE" VARCHAR2(50 BYTE),
    "SENT_DATE" VARCHAR2(50 BYTE),
    "REMARKS" VARCHAR2(200 BYTE),
    "REMAINING_QUANTITY" VARCHAR2(30 BYTE),
    "CODE" VARCHAR2(30 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "LOADER" ACCESS PARAMETERS (
    RECORDS DELIMITED BY newline LOAD WHEN CODE!=BLANKS Skip 1 FIELDS
    TERMINATED BY 0X'09' MISSING FIELD VALUES ARE NULL REJECT ROWS
    WITH
    ALL NULL FIELDS ( Finance_date,
    creation_date, sent_date, Remarks,
    remaining_quantity, code) location ( 'Finance.tsv' )
    I exported the result in xls file and I saw in the last column a special character. The result of a copy and paste is prenseted here : "ABE
    You should notice that the last quote is in the upper line instead of at the end of ABE. This means, I think, that there is a carriage return at the end. And the 0X'09' is the tab separator. How can I get rid of this character ?

    my guess is that you run the load on unix server which uses default LF end-of-line character and the file has dos CRLF end-of-line, the easiest option is to change records delimiter in the DDL and replace "RECORDS DELIMITED BY newline" with code below
    RECORDS DELIMITED BY '\r\n'in general end-of-line can be really any character, sample above shows CRLF but it can be TAB, space, | or any other character or set of characters. I have samples of special characters on my blog http://jiri.wordpress.com/2009/01/29/oracle-external-tables-by-examples-part-1/
    hope this helps
    jiri

  • External Table, Handling Delimited and Special Character in file

    Hi ,
    I have created one external table with these option
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY ***************************************
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    SKIP 0
    FIELDS TERMINATED BY '|'
    OPTIONALLY ENCLOSED BY '"'
    MISSING FIELD VALUES ARE NULL                                          
    LOCATION
    ( 'test_feed.csv'
    Now problem is these are coming as valid.
    anupam|anupam2
    anupam"test|anupam"test2
    "anupam|test3"|test3
    anupam""""test5|test5
    anupam"|test7
    but these are not coming as valid
    "anupam"test4"|test4    --> Case when we have quotes in the filed but still have quotes in it. I guess in this case we can send the filed expect closing double quotes.
    "anupam|test6   --> In case field is starting with double quotes then it's failing
    "anupam"test8|test8"|test8 --> In case one filed contains both pipe ( |) and double quotes then we are sending it enclosed in double quotes. But thats failing the job.
    Can you suggest what is the best way to handle such scenario? ( One restriction though. The file is used by other system - Netezza as well, which can't take more than one character long delimited :'( )

    One approach is to define the external table a ONE column table (with single field on the file). This way each line will come in as a row in the external table. Of course you have to build "parsing logic" on top of that.
    DROP TABLE xtern_table;
    CREATE TABLE xtern_table
        c1 VARCHAR2(4000)
      organization external
        type ORACLE_LOADER DEFAULT directory xtern_data_dir
        ACCESS PARAMETERS (
            RECORDS DELIMITED BY NEWLINE
            FIELDS TERMINATED BY '~'   ---- <<<<<<<< Use a field terminator as a character that is not found in the file
            MISSING FIELD VALUES ARE NULL
            ( c1 CHAR(4000)
         ) location ('mycsv.csv')
    > desc xtern_table
    desc xtern_table
    Name Null Type          
    C1        VARCHAR2(4000)
    > column c1 format A40
    > select * from xtern_table
    C1                                    
    anupam|anupam2                          
    anupam"test|anupam"test2                
    "anupam|test3"|test3                    
    anupam""""test5|test5                   
    anupam"|test7                           
    "anupam"test4"|test4                    
    "anupam|test6                           
    "anupam"test8|test8"|test8              
    8 rows selected
    Ideally, it will be good t have an incoming source file with predictable format.
    Hope this helps.

  • Variable filename external table

    I have written a script to import data from a .csv into a table in Apex:
    CREATE TABLE APEX_USER_002.INK_KASSA_LOAD
    KASS_DTM      VARCHAR2(255),
           KASS_ID       VARCHAR2(255),
           KASS_VKP_COD  VARCHAR2(255),
           KASS_VKP_OMS  VARCHAR2(255),
           KASS_COD VARCHAR2(255),
           KASS_OMS   VARCHAR2(255),
           KASS_PRS_COD VARCHAR2(255),
           KASS_PRS_OMS VARCHAR2(255)
    ORGANIZATION EXTERNAL
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY AFM_KASSA_IN
      ACCESS PARAMETERS
        RECORDS DELIMITED BY NEWLINE CHARACTERSET WE8MSWIN1252
          LOGFILE AFM_KASSA_LOG: 'log.log'
        BADFILE AFM_KASSA_BAD: 'badfile.bad'
        NODISCARDFILE
        SKIP 1
        FIELDS TERMINATED BY ';'
        OPTIONALLY ENCLOSED BY '"'
        LRTRIM
        MISSING FIELD VALUES ARE NULL
    KASS_DTM,
           KASS_ID,
           KASS_VKP_COD,
           KASS_VKP_OMS,
           KASS_COD,
           KASS_OMS,
           KASS_PRS_COD,
           KASS_PRS_OMS
        LOCATION  ('variable_filename.csv')
    It works fine when I put the name of the .csv hardcoded in the script. Like this: LOCATION ('Kassa_20130406130014.csv')
    I have written a function which returns the filename, but when I use the function in LOCATION (function()) I get an error: ora-00905: missing keyword
    How can I call a function in LOCATION ()?

    Hi,
    I'm not sure but I think you need re-create external table.
    Create procedure that drops and re-creates external table dynamically with new file name.
    Or use e.g. DBMS_SCHEDULER to call OS script that renames file always to same name for external table.
    Regards,
    Jari

  • SQL and External table question

    Hello averyone,
    I have a file to be read as an external table part of it is below:
    ISO-10303-21;
    HEADER;
    FILE_DESCRIPTION((''),'2;1');
    FILE_NAME('BRACKET','2005-07-08T',('broilo'),(''),
    'PRO/ENGINEER BY PARAMETRIC TECHNOLOGY CORPORATION, 2004400',
    'PRO/ENGINEER BY PARAMETRIC TECHNOLOGY CORPORATION, 2004400','');
    FILE_SCHEMA(('CONFIG_CONTROL_DESIGN'));
    ENDSEC;
    DATA;
    #5=CARTESIAN_POINT('',(5.5E0,5.5E0,-5.1E1));
    #6=DIRECTION('',(0.E0,0.E0,1.E0));
    #7=DIRECTION('',(-1.E0,0.E0,0.E0));
    #8=AXIS2_PLACEMENT_3D('',#5,#6,#7);
    The first question is: how to ignore the lines until the DATA; line or SQL already does it for me?
    The second question is: since the fields of interest are separated by commas and the first field does not interest me (it is solved with a varchar2) how can I read the following fields as numbers ignoring the (,# and ) characters please?
    Thanks for any help.
    Sincerely yours,
    André Luiz

    The SKIP option can be used with SQL*Loader to skip a certain number of lines before starting to load. Off hand I cannot see any easy way to load the data in the format given. The format does not resemble a typical CVS format. You can look at the test cases provided for SQ*Loader in the Oracle® Database Utilities guide - or simply write PL/SQL code to load this data manually using UTL_FILE.

  • External table in a procedure

    Hi,
    I have an external table script to load data and I need to schedule the loading (every 10 minutes). (env: Windows XP)
    I am planning on putting the external table script in a procedure and call the procedure in the DBMS utility.
    But.... when I put the external table script in the procedure, I am getting compilation errors because of the DROP and CREATE (DDL) statements in the procedure.
    Please help me putting the external table script in the procedure.
    Thanks in advance

    JT,
    If the file is allways the same name, why drop and recreate externale table.
    You can reuse the table even if the file was drop and recreate.
      1   CREATE TABLE EXT_RN_DEPLOY_DATA
      2   (
      3   MONITOR_ID VARCHAR2(30),
      4   SAMPLE_ID VARCHAR2(30),
      5   LATITUDE VARCHAR2(10),
      6   DEW_POINT NUMBER(18,8)
      7   )
      8   ORGANIZATION EXTERNAL
      9   ( TYPE ORACLE_LOADER
    10   DEFAULT DIRECTORY DATA_FILE_DIR2
    11   ACCESS PARAMETERS
    12   ( RECORDS DELIMITED BY NEWLINE SKIP 1
    13   BADFILE DATA_FILE_DIR2:'REVEXT%A_%P.BAD'
    14   LOGFILE DATA_FILE_DIR2:'REVEXT%A_%P.LOG'
    15   FIELDS TERMINATED BY ","
    16   OPTIONALLY ENCLOSED BY '"'
    17   MISSING FIELD VALUES ARE NULL
    18   )
    19   LOCATION (DATA_FILE_DIR2:'load.csv')
    20   )
    21   REJECT LIMIT UNLIMITED
    22   LOGGING
    23   NOCACHE
    24*  NOPARALLEL
    SQL> /
    Table created.
    SQL> create procedure test_ext as
      2  i number;
      3  begin
      4  select count(*) into i from EXT_RN_DEPLOY_DATA;
      5  dbms_output.put_line(i);
      6  end;
      7  /
    Procedure created.
    --The file exists
    SQL> exec test_ext
    0
    PL/SQL procedure successfully completed.
    --I deleted the file
    SQL> exec test_ext
    BEGIN test_ext; END;
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file load.csv in DATA_FILE_DIR2 not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    ORA-06512: at "SCOTT.TEST_EXT", line 4
    ORA-06512: at line 1
    --I recreated the file and populate this one
    SQL> exec test_ext
    2
    PL/SQL procedure successfully completed.
    SQL> Nicolas.

  • External table -Spanish

    I have an external table as described below.
    One record of the csv has these values:
    104,Referencia de reclamación,ES.
    But when I query the table, TP_DESC, here are the values I get:
    1,Referencia de reclamaci�S, null.
    How do I get it to display the Spanish accent correctly? It looks like the accent is messing up the comma, since 'ES' is not being displayed and looks like it got embedded in reclamaci�S
    Please help.
    CREATE TABLE TP_DESC
    P_ID NUMBER(10, 0)
    , DESC VARCHAR2(100 BYTE)
    , LANG_CD VARCHAR2(2 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DIR_CONFIG
    ACCESS PARAMETERS
    RECORDS DELIMITED BY '\r\n' SKIP 1
    BADFILE DIR_CONFIG_BAD_FILE:'VS_INITIAL_LOAD_BAD.log'
    logfile dir_config_log_file:'VS_INITIAL_LOAD_LOG.log'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES ARE NULL
    LOCATION
    DIR_CONFIG: 'TP_DESC.csv'
    REJECT LIMIT UNLIMITED;

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    When you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    You can use CHARACTERSET in external table to specify the character set of your datafile.
    i.e.:CREATE TABLE TP_DESC
    P_ID NUMBER(10, 0)
    , DESC VARCHAR2(100 BYTE)
    , LANG_CD VARCHAR2(2 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DIR_CONFIG
    ACCESS PARAMETERS
    RECORDS DELIMITED BY '\r\n'
    CHARACTERSET WE8MSWIN1252 -- This specifies the character set of datafile
    SKIP 1
    BADFILE DIR_CONFIG_BAD_FILE:'VS_INITIAL_LOAD_BAD.log'
    logfile dir_config_log_file:'VS_INITIAL_LOAD_LOG.log'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES ARE NULL
    LOCATION
    DIR_CONFIG: 'TP_DESC.csv'
    REJECT LIMIT UNLIMITED;
    {code}
    I have used CHARACTERSET WE8MSWIN1252 but you need to check if this one is the one which is the correct one for you.
    Regards.
    Al

  • External Table Question

    I created the external table ext_sftm (see create statement below) and it worked until I added MISSING FIELD VALUES ARE NULL.
    Now when I run SELECT * FROM EXT_SFTM I get the following errors. [1]: (Error): ORA-29913: error in executing ODCIEXTTABLEOPEN callout ORA-29400: data cartridge error KUP-00554: error encountered while parsing access parameters KUP-01005: syntax error: found "missing": expecting one of: "exit, (" KUP-01007: at line 10 column 5 ORA-06512: at "SYS.ORACLE_LOADER", line 14 ORA-06512: at line 1
    What am I doing wrong?
    CREATE TABLE ext_sftm
    (map_id NUMBER(38,0),
    source_id NUMBER(38,0),
    member_acis VARCHAR2(20),
    source_facility_code VARCHAR2(50),
    source_facility_name VARCHAR2(100),
    source_facility_address VARCHAR2(40),
    source_facility_city VARCHAR2(30),
    source_facility_state CHAR(2),
    source_facility_zip VARCHAR2(10),
    source_name VARCHAR2(100))
    ORGANIZATION EXTERNAL (
    DEFAULT DIRECTORY DCS_DIR
    ACCESS PARAMETERS(RECORDS DELIMITED BY NEWLINE CHARACTERSET WE8ISO8859P1
    BADFILE 'DCS_DIR':'SFTM.bad'
    LOGFILE 'SFTM.log'
    READSIZE 1048576
    SKIP 1
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    REJECT ROWS WITH ALL NULL FIELDS
    MISSING FIELD VALUES ARE NULL
    LOCATION (
    DCS_DIR:'SFTM.csv'
    REJECT LIMIT UNLIMITED
    /

    According to Metalink note:
    Subject:      Select from external table gives ORA-29913 ORA-29400 KUP-00554 KUP-01005
         Doc ID:      Note:302672.1      Type:      PROBLEM
         Last Revision Date:      22-APR-2005      Status:      MODERATED
    This is an syntax error dues to wrong order of field definitions and record format info.
    I suspect something wrong with this line:
    REJECT ROWS WITH ALL NULL FIELDSSee following syntax diagram:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/img_text/et_fields_clause.htm
    Message was edited by:
    Pierre Forstmann
    Message was edited by:
    Pierre Forstmann

  • IGNORE COMMENTS IN EXTERNAL TABLE FILE

    I currently have a partitioned table, split by month going back some 7 years.
    The business have now agreed to archive off some of the data but to have it
    available if required. I therefore intend to select month by month, the data
    to a flat file and make use of external tables to provide the data for the
    business if required. Then to remove the months partition thus releaseing
    space back to the database. Each months data is only about 100bytes long, but
    there could be about 15million rows.
    I can successfully create the external table and read the data.
    However I would like to place a header in the spooled file but the only method
    I have found to ignore the header is to use the "SKIP" parameter. I would
    rather not use this as it hard codes the number of lines I reserve for a
    header.
    Is there another method to add a comment to a external tables file and have the
    selects on the file ignore the comments?
    Could I use "LOAD WHEN ( column1 != '--' )" as each comment line begins with a
    double dash?
    Also, is there a limit to the size of an external tables file?

    When I added the lines to attempt to
    exclude the Header lines to be:
    RECORDS DELIMITED BY newline
    NOBADFILE
    NODISCARDFILE
    NOLOGFILE
    SKIP 0
    LOAD WHEN ( cvt_seq_num LIKE '--%' )
    FIELDS
    TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    ( cvt_seq_num INTEGER EXTERNAL(12)
    I got:
    select * from old_cvt_external
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPENcallout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "identifier": expecting one of: "equal,notequal"
    KUP-01008: the bad identifier was: LIKE
    KUP-01007: at line 6 column 33
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    When I moved the line I got:
    RECORDS DELIMITED BY newline
    NOBADFILE
    NODISCARDFILE
    NOLOGFILE
    SKIP 0
    FIELDS
    TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    LOAD WHEN ( cvt_seq_num LIKE '--%' )
    I got:
    select * from old_cvt_external
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "load": expecting one of: "exit, ("
    KUP-01007: at line 11 column 11
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    So it appears that the "LOAD WHEN" does not work.
    Can you please suggest anything else?

  • Error  in external table

    Suppose we have a file containing city populations in our /tmp directory and we wish to access this data from within our database.
    Tokyo,Japan,33600000
    Seoul,South Korea,23400000
    Mexico City,Mexico,22400000
    New York,USA,21900000
    Bombay,India,21600000
    Delhi,India,21500000
    Sao Paulo,Brazil,20600000
    Los Angeles,USA,18000000
    Shanghai,China,17500000O
    saka,Japan,16700000
    First, we create a DIRECTORY object which will reference the /tmp directory in our file system.
    CREATE OR REPLACE DIRECTORY tmp_dir AS '/tmp';
    Directory created
    Now, we create an external table by specifying the name of the file we wish to query and the directory where it can be located. We will rely on the default values of comma for a field separator and new line as the record delimiter, to describe our data.
    CREATE TABLE pop_ext ( city VARCHAR2(30),
    country VARCHAR2(30),
    population NUMBER)
    ORGANIZATION EXTERNAL
    (DEFAULT DIRECTORY tmp_dir
    LOCATION('pop.txt'));
    Table created.
    But when run the below query
    SELECT * FROM pop_ext;
    I am getting following error
    ORA-29913: error in executing ODCIEXTTABLEFETCH callout
    ORA-30653: reject limit reached
    ORA-06512: at "SYS.ORACLE_LOADER", line 52

    Hi Sri ram,
    we have a file which contains bank holidays in the UK for 2007 to 2009.
    "Holiday" 2007 2008 2009
    "New Year" 01/01/07 01/01/08 01/01/09
    "Good Friday" 06/04/07 21/03/08 10/04/09
    "Easter Monday" 09/04/07 24/03/08 13/04/09
    "Early May" 07/05/07 05/05/08 04/05/09
    "(First Monday in May)"
    "Spring Bank" 28/05/07 26/05/08 25/05/09
    "(Last Monday in May)"
    "Summer" 27/08/07 25/08/08 31/08/09
    "(Last Monday in August)"
    "Christmas Day" 25/12/07 25/12/08 25/12/09
    "Boxing Day" 26/12/07 26/12/08 28/12/09
    CREATE OR REPLACE DIRECTORY log_dir AS '/logs';
    Directory created.
    CREATE TABLE bank_hol_ext(
    hol_desc VARCHAR2(50),
    hol_2007 DATE,
    hol_2008 DATE,
    hol_2009 DATE )
    ORGANIZATION EXTERNAL
    TYPE oracle_loader
    DEFAULT DIRECTORY etl_dir
    ACCESS PARAMETERS
    ( records delimited BY newline
    load when (hol_2007 != BLANKS)
    badfile log_dir:'bank_holidays.bad'
    logfile log_dir:'bank_holidays.log'
    discardfile log_dir:'bank_holidays.dsc'
    skip 1 fields terminated by '\t'
    optionally enclosed by '"'
    missing field values are null
    (hol_desc,
    hol_2007 DATE "dd/mm/yy",
    hol_2008 DATE "dd/mm/yy",
    hol_2009 DATE "dd/mm/yy" )
    LOCATION('hols.txt')) REJECT LIMIT UNLIMITED
    table is created
    when I execute below query
    SELECT * FROM bank_hol_ext;
    I am getting error

Maybe you are looking for

  • Query on STO configuration?

    Hello Gurus, I m creating STO in me21n using UB doc type.I m entering supplying plant and receiving plant under one company code.It is allowing me to save the PO. But, in configuration(set up stock transport order), "assign delivery type, one step pr

  • Create a database field in Repetitive Area

    Hi, I generated a report from query, but I can't insert a database field in a Repetitive Area using PLD. I've tried inserted a Text Field and changed to Database field, but there is nothing shown. does anyone can help? Thanks Kim

  • CS 4 Crash when I open Edit or right click

    Hello, I am using InDesign CS 4 from the past 20 odd days, & I it has been working fine, but since the past 2 days, I am getting a peculiar problem. The problem first started when I opened one of the .indd files & resized an image & right clicked on

  • HT201303 I'd like my security questions/answers reset.

    I'd like my security questions/answers reset.

  • Video level changes after render

    I used 3-way Color Corrector to adjust levels on my video clip.  It looks good on the scope, but after I render, the video level returns to 105%.  I searched for this problem in the archive, and the suggestion was to change render settings to "render