Flat file created ,external table created, deployed successfully but...

hi everyone,
I have a problems :
I have created a flat file through flat file module from a text file.
i've done it successfully,
then i create an external table through external table module for the same
flat file , went successfully,
then velidation went successfull,
and i carried out deployement for the same, that also done successfully.
but when i tried to check the database through SQL-Plus :
i came across with the following error :
SQL> CONNECT TARGET_SCHEMA/TARGET_SCHEMA
Connected.
SQL> SELECT * FROM CUMMINS_EXT;
SELECT * FROM CUMMINS_EXT
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Cumminsparts.txt in TARGET_LOC_CUMMINS_LOC not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
ORA-06512: at line 1
Please someone guide me to resolve this prob.
Thanking you,

Thanks to you all,
I had created a new file location in OWB to create
a flat file module but I dont know somewhere
i missed something while creating the new file location
that is why it was not loading data inspite of deploy successed ,
but when i put the same file to one of existing file location
and i deployed it and i got the data.
now i am exploring the existing file location for what was that
i missed during creation of new location.
Guys i am new to OWB so i dont know how to go about , if you have any
easy way to get hands on OWB, please let me know
Once again thanks everybody.

Similar Messages

  • Can we cleanse and transform data at flat file or external table level?

    Hi,
    I have some data that I want to cleanse and transform. I don't want to cleanse it after i populate the external table, I want to get done with it at flat file level or while populating the external table. Can we cleanse and transform data at flat file or external table level through Oracle or OWB 11.2? Is it possible to run a conditional load (i.e. having a where clause or if-else-then) for an external table? Can we call oracle functions for an external table at the time of creation?
    Thanks in advance.
    Regards,
    Ann.

    Hi Oleg,
    Thanks a lot for the clarification. :)
    So is there a way that I can clease the data within the text file through Oracle or OWB? I have datatype mismatches in the data and most of my data is getting rejected because of that. The way I can think of, for solving this problem, is to create the external table with all fields with datatype varchar and then cleansing the data. But it doesn't seem very effecient plus it will get very complicated because I have almost 80-90 fields.
    Any help?
    Thanks and regards,
    Ann.

  • Sqlldr flat file to external table using shell scripts

    Hi,
    Has anyone done this before? Please give me a hand.
    Thanks!

    Thanks Justin.
    When do I need to create the external table EMP_STAGING ?
    These are my steps so far:
    - shell script to crate the flat file (but I need to change the table name to EMP_STAGING)
    - use a script to call sqlldr to load the flat file into the external table
    - then the script will call the MERGE sql script to merge the data from the external table into the database table
    Am I on the right track?
    In which stage should I create and drop the external table?
    Thanks!

  • Unable to read chinese characters in a flat file to external table

    Hi All,
    We have a flat file containing data in chinese. We are using external table to read data in files. When i do select <coulmn-name> from <table> it displays box for the chinese characters. The column is of type varchar2.
    The NLS_LANGUAGE is AMERICAN and NLS_CHARACTERSET is AL32UTF8.
    The character set is mentioed as UTF8 in external table defnition.
    Is the external table not reading these charcters properly? Should any patch be installed or some settings should be changed for sql developer to to display chinese character?

    The NLS_LANG environment variable/registry string variable (You are just one of the 1000s of 'anonymous' users refusing to post platform and version), so NOT NLS_LANGUAGE, on the server hosting the file, should be set to anything ending in .AL32UTF8
    Sybrand Bakker
    Senior Oracle DBA

  • Error while creating external table

    Hi i tried to create external table. The table is created but while selecting that table it is throwing below errors
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file Countries1.txt in EXT_TABLES not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19I've created temp directory in window under oracle directory " C:\oracle\product\10.2.0\temp"
    In the temp directory i've a text file countries1.txt
    the text file has the below information
    ENG,England,English
    SCO,Scotland,English
    IRE,Ireland,English
    WAL,Wales,WelshI've connected to system user and created one directory and granted the read and write permissions to user SCOTT.
    SQL> create or replace directory ext_tables as 'C:\oracle\product\10.2.0\temp\';
    Directory created.
    SQL> grant read,write on directory ext_tables to scott;
    Grant succeeded.The creation of external table query is
    CREATE TABLE countries_ext (
      country_code      VARCHAR2(5),
      country_name      VARCHAR2(50),
      country_language  VARCHAR2(50)
    ORGANIZATION EXTERNAL (
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY ext_tables
      ACCESS PARAMETERS (
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        MISSING FIELD VALUES ARE NULL
          country_code      CHAR(5),
          country_name      CHAR(50),
          country_language  CHAR(50)
      LOCATION ('Countries1.txt')
    PARALLEL 5
    REJECT LIMIT UNLIMITED;And the error is
    SQL> select *from countries_ext;
    select *from countries_ext
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file Countries1.txt in EXT_TABLES not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    SQL> Please help me in this

    You are missing something. Most probably the file does not exists in your specified path. This is working in my 10.2.0.3
    Step1: Check the file is actually there.
    C:\oracle\product\10.2.0>mkdir temp
    C:\oracle\product\10.2.0>cd temp
    C:\oracle\product\10.2.0\temp>dir
    Volume in drive C is C_Drive
    Volume Serial Number is 8A93-1441
    Directory of C:\oracle\product\10.2.0\temp
    07/30/2011  12:00 PM    <DIR>          .
    07/30/2011  12:00 PM    <DIR>          ..
    07/30/2011  12:00 PM                79 countries1.txt
                   1 File(s)             79 bytes
                   2 Dir(s)  50,110,582,784 bytes free
    C:\oracle\product\10.2.0\temp>type countries1.txt
    ENG,England,English
    SCO,Scotland,English
    IRE,Ireland,English
    WAL,Wales,Welsh
    C:\oracle\product\10.2.0\temp>Step 2: Creating the directory object.
    SQL> show user
    USER is "SYS"
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL> create or replace directory ext_tables as 'C:\oracle\product\10.2.0\temp';
    Directory created.
    SQL> grant read,write on directory ext_tables to scott;
    Grant succeeded.
    SQL>Step 3: Table definition.
    C:\>sqlplus scott@orclsb/tiger
    SQL*Plus: Release 10.1.0.4.2 - Production on Sat Jul 30 12:04:24 2011
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE TABLE countries_ext (
      2    country_code      VARCHAR2(5),
      3    country_name      VARCHAR2(50),
      4    country_language  VARCHAR2(50)
      5  )
      6  ORGANIZATION EXTERNAL (
      7    TYPE ORACLE_LOADER
      8    DEFAULT DIRECTORY ext_tables
      9    ACCESS PARAMETERS (
    10      RECORDS DELIMITED BY NEWLINE
    11      FIELDS TERMINATED BY ','
    12      MISSING FIELD VALUES ARE NULL
    13      (
    14        country_code      CHAR(5),
    15        country_name      CHAR(50),
    16        country_language  CHAR(50)
    17      )
    18    )
    19    LOCATION ('Countries1.txt')
    20  )
    21  PARALLEL 5
    22  REJECT LIMIT UNLIMITED;
    Table created.
    SQL> SELECT * FROM countries_ext;
    COUNT COUNTRY_NAME
    COUNTRY_LANGUAGE
    ENG   England
    English
    SCO   Scotland
    English
    IRE   Ireland
    English
    COUNT COUNTRY_NAME
    COUNTRY_LANGUAGE
    WAL   Wales
    Welsh

  • Can i create External Table dynamically

    Hi,
    Is it possible to create External Table dynamically ?
    I want to use the following dynamically to create External Table.
    1) fields
    2) field position
    3) file location
    Thanks

    The answer shouldn't be very different of already given answers in your Can i create external table dynamically? of the last month, is it ?
    And question is still same : why wanted such thing ?
    Nicolas.

  • Create external table in procedure

    i have a PL/SQL Block [ well i'm not created procedure still]
    /* Formatted on 2011/01/05 11:53 (Formatter Plus v4.8.8) */
    DECLARE
    -- create header
       p_formula_no                VARCHAR2 (200);
       p_formula_vers              NUMBER;
       p_formula_desc              VARCHAR2 (200);
       p_formula_desc2             VARCHAR2 (200);
       p_formula_class             VARCHAR2 (200);
       p_owner_organization_id     NUMBER;
       p_owner_id                  NUMBER;
       p_formula_type              NUMBER;
       p_scale_type                NUMBER;
       p_text_code                 NUMBER;
       p_last_update_date          DATE;
       p_auto_product_calc         VARCHAR2 (200);
       x_formula_id                NUMBER;
       x_return_code               VARCHAR2 (200);
       x_error_msg                 VARCHAR2 (200);
       formula_id                  NUMBER;
    -- update header
       p_formula_id                NUMBER;
       p_formula_status            VARCHAR2 (200);
       p_user_id                   NUMBER;
       p_last_update_date_orig     DATE;
       p_formulaline_id            NUMBER;
       p_line_type                 NUMBER;
       p_line_no                   NUMBER;
       p_item_id                   NUMBER;
       p_item_no                   VARCHAR2 (200);
       p_revision                  VARCHAR2 (200);
       p_qty                       NUMBER;
       p_item_um                   VARCHAR2 (200);
       p_release_type              NUMBER;
       p_scrap_factor              NUMBER;
       p_cost_alloc                NUMBER;
       p_phantom_type              NUMBER;
       p_rework_type               NUMBER;
       p_tp_formula_id             NUMBER;
       p_iaformula_id              NUMBER;
       p_scale_uom                 VARCHAR2 (200);
       p_contribute_step_qty_ind   VARCHAR2 (200);
       p_contribute_yield_ind      VARCHAR2 (200);
       p_scale_multiple            NUMBER;
       p_scale_rounding_variance   NUMBER;
       p_rounding_direction        NUMBER;
       p_by_product_type           VARCHAR2 (200);
       p_prod_percent              NUMBER;
    -- create header and update header cursors
       CURSOR c1
       IS
          SELECT DISTINCT formula_no, formula_ver, formula_desc, formula_class,
                          owner_header
                     FROM api_formula;
    -- for product cursors
       CURSOR c2
       IS
          SELECT *
            FROM api_formula
           WHERE line_type = 1;
    -- for ingredient cursors
       CURSOR c3
       IS
          SELECT *
            FROM api_formula
           WHERE line_type = -1;
       hdr                     c1%ROWTYPE;
       prod                        c2%ROWTYPE;
       ing                         c3%ROWTYPE;
    BEGIN
    -- for create and update header
       OPEN c1;
       FETCH c1
        INTO hdr;
       WHILE c1%FOUND
       LOOP
          p_formula_no := hdr.formula_no;
          p_formula_vers := hdr.formula_ver;
          p_formula_desc := hdr.formula_desc;
          p_formula_desc2 := NULL;
          p_formula_class := hdr.formula_class;
          p_owner_organization_id := 327;
          p_owner_id := 1298;
          p_formula_type := 0;
          p_scale_type := 0;
          p_text_code := 0;
          p_last_update_date := SYSDATE;
          p_auto_product_calc := 'Y';
          x_formula_id := NULL;
          x_return_code := NULL;
          x_error_msg := NULL;
          apps.gmd_formula_designer_pkg_cust.create_formula_header
                                                        (p_formula_no,
                                                         p_formula_vers,
                                                         p_formula_desc,
                                                         p_formula_desc2,
                                                         p_formula_class,
                                                         p_owner_organization_id,
                                                         p_owner_id,
                                                         p_formula_type,
                                                         p_scale_type,
                                                         p_text_code,
                                                         p_last_update_date,
                                                         p_auto_product_calc,
                                                         x_formula_id,
                                                         x_return_code,
                                                         x_error_msg
          COMMIT;
          SELECT formula_id
            INTO formula_id
            FROM fm_form_mst_b
           WHERE formula_no = hdr.formula_no;
          p_formula_id := formula_id;
          p_formula_no := NULL;
          p_formula_vers := NULL;
          p_formula_desc := NULL;
          p_formula_desc2 := NULL;
          p_formula_status := 700;
          p_formula_class := NULL;
          p_owner_organization_id := 327;
          p_owner_id := 1298;
          p_formula_type := 0;
          p_scale_type := 0;
          p_text_code := NULL;
          p_last_update_date := SYSDATE;
          p_user_id := 1298;
          p_last_update_date_orig := SYSDATE;
          p_auto_product_calc := 'Y';
          x_return_code := NULL;
          x_error_msg := NULL;
          apps.gmd_formula_designer_pkg_cust.update_formula_header
                                                         (p_formula_id,
                                                          p_formula_no,
                                                          p_formula_vers,
                                                          p_formula_desc,
                                                          p_formula_desc2,
                                                          p_formula_status,
                                                          p_formula_class,
                                                          p_owner_organization_id,
                                                          p_owner_id,
                                                          p_formula_type,
                                                          p_scale_type,
                                                          p_text_code,
                                                          p_last_update_date,
                                                          p_user_id,
                                                          p_last_update_date_orig,
                                                          p_auto_product_calc,
                                                          x_return_code,
                                                          x_error_msg
          DBMS_OUTPUT.put_line (x_return_code);
          DBMS_OUTPUT.put_line (x_error_msg);
          COMMIT;
          -- for PROD
          OPEN c2;
          FETCH c2
           INTO prod;
          WHILE c2%FOUND
          LOOP
             p_formula_id := formula_id;
             p_formulaline_id := NULL;
             p_line_type := 1;
             p_line_no := prod.line_no;
             p_item_id := prod.item_id;
             p_item_no := prod.item_name;
             p_revision := NULL;
             p_qty := prod.qty;
             p_item_um := prod.uom;
             p_release_type := 0;
             p_scrap_factor := 0;
             p_scale_type := 1;
             p_cost_alloc := 1;
             p_phantom_type := 0;
             p_rework_type := NULL;
             p_text_code := NULL;
             p_tp_formula_id := NULL;
             p_iaformula_id := NULL;
             p_scale_uom := NULL;
             p_contribute_step_qty_ind := NULL;
             p_contribute_yield_ind := NULL;
             p_scale_multiple := NULL;
             p_scale_rounding_variance := NULL;
             p_rounding_direction := NULL;
             p_by_product_type := NULL;
             p_last_update_date := SYSDATE;
             p_user_id := 1298;
             p_prod_percent := NULL;
             x_return_code := NULL;
             x_error_msg := NULL;
             apps.gmd_formula_designer_pkg.insert_formula_detail
                                                      (p_formula_id,
                                                       p_formulaline_id,
                                                       p_line_type,
                                                       p_line_no,
                                                       p_item_id,
                                                       p_item_no,
                                                       p_revision,
                                                       p_qty,
                                                       p_item_um,
                                                       p_release_type,
                                                       p_scrap_factor,
                                                       p_scale_type,
                                                       p_cost_alloc,
                                                       p_phantom_type,
                                                       p_rework_type,
                                                       p_text_code,
                                                       p_tp_formula_id,
                                                       p_iaformula_id,
                                                       p_scale_uom,
                                                       p_contribute_step_qty_ind,
                                                       p_contribute_yield_ind,
                                                       p_scale_multiple,
                                                       p_scale_rounding_variance,
                                                       p_rounding_direction,
                                                       p_by_product_type,
                                                       p_last_update_date,
                                                       p_user_id,
                                                       p_prod_percent,
                                                       x_return_code,
                                                       x_error_msg
             DBMS_OUTPUT.put_line (x_return_code);
             DBMS_OUTPUT.put_line (x_error_msg);
             COMMIT;
             FETCH c2
              INTO prod;
          END LOOP;
          -- for ing
          OPEN c3;
          FETCH c3
           INTO ing;
          WHILE c3%FOUND
          LOOP
             p_formula_id := formula_id;
             p_formulaline_id := NULL;
             p_line_type := -1;
             p_line_no := ing.line_no;
             p_item_id := ing.item_id;
             p_item_no := ing.item_name;
             p_revision := NULL;
             p_qty := ing.qty;
             p_item_um := ing.uom;
             p_release_type := 0;
             p_scrap_factor := 0;
             p_scale_type := 1;
             p_cost_alloc := 1;
             p_phantom_type := 0;
             p_rework_type := NULL;
             p_text_code := NULL;
             p_tp_formula_id := NULL;
             p_iaformula_id := NULL;
             p_scale_uom := NULL;
             p_contribute_step_qty_ind := NULL;
             p_contribute_yield_ind := NULL;
             p_scale_multiple := NULL;
             p_scale_rounding_variance := NULL;
             p_rounding_direction := NULL;
             p_by_product_type := NULL;
             p_last_update_date := SYSDATE;
             p_user_id := 1298;
             p_prod_percent := NULL;
             x_return_code := NULL;
             x_error_msg := NULL;
             apps.gmd_formula_designer_pkg.insert_formula_detail
                                                      (p_formula_id,
                                                       p_formulaline_id,
                                                       p_line_type,
                                                       p_line_no,
                                                       p_item_id,
                                                       p_item_no,
                                                       p_revision,
                                                       p_qty,
                                                       p_item_um,
                                                       p_release_type,
                                                       p_scrap_factor,
                                                       p_scale_type,
                                                       p_cost_alloc,
                                                       p_phantom_type,
                                                       p_rework_type,
                                                       p_text_code,
                                                       p_tp_formula_id,
                                                       p_iaformula_id,
                                                       p_scale_uom,
                                                       p_contribute_step_qty_ind,
                                                       p_contribute_yield_ind,
                                                       p_scale_multiple,
                                                       p_scale_rounding_variance,
                                                       p_rounding_direction,
                                                       p_by_product_type,
                                                       p_last_update_date,
                                                       p_user_id,
                                                       p_prod_percent,
                                                       x_return_code,
                                                       x_error_msg
             DBMS_OUTPUT.put_line (x_return_code);
             DBMS_OUTPUT.put_line (x_error_msg);
             COMMIT;
             FETCH c3
              INTO ing;
          END LOOP;
          FETCH c1
           INTO hdr;
       END LOOP;
       DBMS_OUTPUT.put_line (p_formula_id);
       DBMS_OUTPUT.put_line (x_return_code);
       DBMS_OUTPUT.put_line (x_error_msg);
    END;in this PL/SQL Block i'm used external table which is "API_FORMULA"
    the coding is
    create table api_formula
           ( FORMULA_NO varchar2(2000),
             FORMULA_VER NUMBER,
             FORMULA_DESC varchar2(2000),
             FORMULA_CLASS varchar2(2000),
             ORG NUMBER,
             OWNER_HEADER NUMBER,
             LINE_TYPE NUMBER,
           LINE_NO NUMBER,
             ITEM_ID NUMBER,
           ITEM_NAME VARCHAR2(2000),
           QTY NUMBER,
             UOM VARCHAR2(200),
             SCRAP_FAC NUMBER,
             SCRAP_TYPE NUMBER,
             UPDATE_DATE date,
             OWNER_LINE NUMBER,
               testt char(2)/*,
             future_use varchar2(200)*/
           organization external
           ( default directory ZAFAR
             access parameters
             ( records delimited by newline
               fields terminated by ','
             location ('HEADER.csv') 
    reject limit 100   
         ;i want this create external table statment in my Pl/SQL Block and when all the execution is complete then drop the table
    how it is possible??
    regard
    chintoo

    user11156570 wrote:
    @BluShadow
    ok .. i want to delete all rows from table in the end when execute this PL/SQLdelete all rows from what table?
    If you're referring to the external table, it's a file on the filesystem, you don't delete rows from it, you just replace/overwrite/delete the file as and when necessary.
    blushadow how i crate a reliable code.. can u suggest me?Basics of transactions... you commit when a business rule/process is complete, not for every little technical thing your code does. In your case I would expect a single commit at the end of the code.
    I don't have your tables, data or know what the code is supposed to be achieving, but you can bet your bottom dollar that if you're nesting cursor loops within each other then the code is running much slower than if you generated the data from a single SQL statement/cursor. I certainly have no clue what those procedure calls are doing, but it looks like they're using a load of OUT parameters. Are they user defined procedures or something that's part of e.g. Oracle Apps? If they're user defined I would consider redesigning all the code to use functions and pass back a structured data type with the required data.

  • Creating External Tables

    In Oracle9i, you can use directly use flat files without first loading the flat files into a table. Can somebody point to where this feature is explained in the documentation?
    Santo

    Santo.
    The following link to a Daily Feature will provide you with an overview and an example of external tables:
    http://technet.oracle.com/products/oracle9i/daily/may24.html
    Harold

  • Map FLAT file to oracle table using 9.04 version - PLS HELP!!!!

    Hello all
    I am having a problem with mapping a flat file to oracle table. The validation is successful, when I go to Project/Deployment manager. Try to deploy the mapping itself and the target table. It said succesful, and the last step is another "Deploy", this one is fail. Saying could not locate the file (which is a flat file) , but it is there on the server.
    I have read all the help on line and follow what they show me, but still not work
    Any ideas? Please provide detail answer if you know it.
    Thank in advance

    Hallo,
    just give a rights on connector
    Variant 1
    1. connect to user sys
    2. grant read,write on directory <connector_name> to <target_schema>;
    or
    Variant 2
    1. as user sys or system give CREATE_ANY_DIRECTORY to <target_schema>
    2. manualy make CREATE DIRECTORY <connector_name> as '<full_path_to_directory>';
    and enjoy :)
    PS: <connector_name> you can take from script CREATE_TABLE wisch in Generation phase was created!
    Kirill

  • OWB - Flat file to oracle table

    Second message, please read.
    OS- Microsoft windows 2000 5.00.2195 Service Pack 2
    OWB client---9.0.3.33.0
    OWB Repository--9.0.3.0.1
    Database--oracle 9i Enterprise Edition 9.0.1.3.1 with the partioning option Jserver Release9.0.1.3.0
    OEM--9.0.1.0.0
    I have created mapping between the source(flat file)and target(oracle)using Oracle Warehouse Builder. Mapping was validated, configured and it successfully generated without errors. The ‘Deploy’ button and the ‘Run’ button are disabled. How can I run/deploy this mapping ?
    The above OWB copy was downloaded from the Oracle corp website. Is this version an evaluation copy? Alternatively Is this a beta copy ?
    Please help.

    Dear All,
    I have a problem with loading flat files to oracle tables using OWB 9.2
    i created a map with my flat file as a source and my oracle table as a target,and i created a connector between the target location and the flat file location.And i deployed the connector and registered the flat file location using my PC information and the path of the files on my pc.
    I generated the map and saved the .ctl file and deployed the map,and hence trying to load the ctl file using the sql loader as the following:
    C:\Documents and Settings\CORAL 2000>sqlldr owb_rt_rep/owb_rt_rep@ofsa
    control = D:\oracle2\ofsa\owb\codegen\BM_DEBIT_CARDS_DAT_MAP.ctl
    ---where owb_rt_rep is my runtime repository user.
    I got the following error:
    SQL*Loader-350: Syntax error at line 18.
    Expecting "(", found ".".
    INTO TABLE "{{TRG_LOC1.Schema}}"."BM_DEBIT_CARDS_DAT"
    --where trg_loc1 is my target location and bm_debit_cards_dat is my target table.
    I tried to grant from the target schema the privelages to the runtime user incase its the problem,but still it didn't work.
    Any ideas??
    Dina Nagia
    Message was edited by:
    Dina Nagia

  • Conversion of fixed length flat files to oracle table

    hello friends
    Please help me getting the code for conversion of fixed length flat files to oracle table
    Should the tables be pre-defined ?????
    In this case the de-limiters are variable length spaces and not commas.Please help me with the same
    Regards,
    -Mahesh

    You can use SQL*Loader to load fixed-width files into Oracle. Instructions on writing appropriate control files are in the Oracle Utilities manual
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch03.htm#1004687
    You can also use external tables, assuming you're using 9i or later (the syntax for external table definitions is nearly identical to the syntax for SQL*Loader control files).
    You'll need to create a table definition in Oracle. You can either create a "normal" table and use SQL*Loader to populate it or you can create an external table definition.
    Justin

  • How to read any file using external tables.

    Hi folks,
    I have written an application that reads a series of csv files using external tables which works fine as long as I specify each file name in the directory i.e.......
    CREATE TABLE gb_test
    (file_name varchar2(10),
    rec_date date
    rec_name VARCHAR2(20),
    rec_age number,
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY GB_TEST
    ACCESS PARAMETERS
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    LOCATION ('data1.csv','data2.csv','data3.csv','data4.csv')
    PARALLEL 5
    REJECT LIMIT 20000;
    However I have discovered that I may not know the name of the files to be processed prior to the program being run so just want to read any file regardless of it's name (although it will always be a .csv file).
    Is there a way to ensure that you don't need to specify the files to be read in the LOCATION part of the syntax.
    Thanks in advance.
    Graham.

    Right, I have now completed this, however it's currently only working as SYS as opposed to any user, however here is a detail of the scenario and the steps required in case any of you guys need in the future ......
    The problem was I needed to search for csv files on my hard-drive. These files would be stored in a series of directories (a through to z), so I needed a way to read all 26 directories and process all files in these directories.
    The problem was, prior to running the program, the user would remove all the files in the directories and insert new ones, but it was never known how many he would decide to do each time.
    Solution: I created a table called stock_data_directories as follows ...
    create table stock_data_directories(sdd_rec_no number,
    sdd_table_name varchar2(50),
    sdd_directory_name varchar2(50),
    sdd_directory_path varchar2(100));
    Then inserted 26 records like ...
    insert into stock_data_directories(sdd_rec_no,sdd_table_name,sdd_directory_name,sdd_directory_path)
    values(1,'rawdata_a','KPOLLOCKA','C:\KPOLLOCK\A')
    insert into stock_data_directories(sdd_rec_no,sdd_table_name,sdd_directory_name,sdd_directory_path)
    values(2,'rawdata_b','KPOLLOCKB','C:\KPOLLOCK\B');
    etc...etc...
    Then created 26 DIRECTORIES E.G.
    CREATE OR REPLACE DIRECTORY KPOLLOCKA AS 'C:\KPOLLOCK\A';
    CREATE OR REPLACE DIRECTORY KPOLLOCKB AS 'C:\KPOLLOCK\B';
    Then created 26 external tables like the following ...
    CREATE TABLE rawdata_a
    (stock varchar2(1000),
    stock_date varchar2(10),
    stock_open VARCHAR2(20),
    stock_high varchar2(20),
    stock_low varchar2(20),
    stock_close VARCHAR2(30),
    stock_qty varchar2(20) )
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY KPOLLOCKA
    ACCESS PARAMETERS
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    LOCATION ('AA.csv')
    PARALLEL 5
    REJECT LIMIT 20000
    This basically says in directory rawdata_a it currently has 1 file called AA.csv.
    Then wrote a procedure as follows ...
    procedure p_process_files(pv_return_message OUT varchar2)is
    cursor c_get_stock_data_directories is
    select distinct sdd_directory_path,
    sdd_table_name
    from stock_data_directories
    order by sdd_table_name;
    vv_return_message varchar2(1000);
    begin
    -- here get the files for each directory
    for r_get_stock_directories in c_get_stock_data_directories loop
    p_build_external_table(r_get_stock_directories.sdd_directory_path,
         r_get_stock_directories.sdd_table_name,
         vv_return_message);
    end loop;
    end;
    then wrote a procedure called p_build_external_table as follows ...
    procedure p_build_external_table(pv_directory_path IN stock_data_directories.sdd_directory_path%type, -- e.g. 'C:\kpollock\A\
    pv_table_name IN stock_data_directories.sdd_table_name%type, -- e.g. rawdata_a
    pv_return_message OUT varchar2) is
    vv_pattern VARCHAR2(1024);
    ns VARCHAR2(1024);
    vv_file_name varchar2(4000);
    vv_start_string varchar2(1) := '''';
    vv_end_string varchar2(3) := ''',';
    vn_counter number := 0;
    vv_err varchar2(2000);
    BEGIN
    vv_pattern := pv_directory_path||'*';
    SYS.DBMS_BACKUP_RESTORE.searchFiles(vv_pattern, ns);
    FOR each_file IN (SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT) LOOP
    if each_file.name like '%.CSV' then
    vv_file_name := vv_file_name||vv_start_string||substr(each_file.name,instr(each_file.name,'\',1,3)+1)||vv_end_string;
         vn_counter := vn_counter + 1;
    end if;
    END LOOP;
    vv_file_name := substr(vv_file_name,1,length(vv_file_name)-1); -- remove final , from string
    execute immediate 'alter table '||pv_table_name||' location('||vv_file_name||')';
    pv_return_message := 'Successfully changed '||pv_table_name||' at '||pv_directory_path||' to now have '||to_char(vn_counter)||' directories';
    exception
    when others then
    vv_err := sqlerrm;
    pv_return_message := ' Error found updating directories. Error = '||vv_err;
    END;
    This reads every file in the directory and appends it to a list, so if it finds A.csv and ABC.csv, then using the dynamic sql, it alters the location to now read 'a.csv','abc.csv',
    It ignores all other file extentions.

  • Flat file to target table map in 11G

    Hi,
    I am havin many problem with my 10G R1 map that have been migrated to 11G.
    all that my 10G map has is mapping from flat file to stage table. It also had one constant operator. i am getting error coz of this constant that i am setting up in the map.
    when i validate this constant variable i get error mess:
    API8534:Validation no supported for language SQLLOADER,property Expression for SAASD_MAP
    -- Generator Version : 11.1.0.7.0
    -- Created Date : Mon May 11 21:16:25 CDT 2009
    -- Modified Date : Mon May 11 21:16:25 CDT 2009
    -- Created By : OWB_WUSER
    -- Modified By : OWB_WUSER
    -- Generated Object Type : SQL*Loader Control File
    -- Generated Object Name : "SADAD_MAP"
    -- Copyright © 2000, 2007, Oracle. All rights reserved.
    OPTIONS (BINDSIZE=50000,ERRORS=50,ROWS=200,READSIZE=65536)
    LOAD DATA
    CHARACTERSET WE8MSWIN1252
    INFILE '{{ETL_FILE_LOC.RootPath}}{{}}dgp.dat'
    BADFILE '{{ETL_FILE_LOC.RootPath}}{{}}dgp.bad'
    DISCARDFILE '{{ETL_FILE_LOC.RootPath}}{{}}dgp.dis'
    CONCATENATE 1
    INTO TABLE "STAGING"."DGP_STAGG"
    APPEND
    REENABLE DISABLED_CONSTRAINTS
    WHEN (1:2) = 'EM'
    "PHONE_COUNTRY" CONSTANT ''Asia'',
    "MRI" POSITION(1:2) CHAR(2) ,
    if you note 11G some how does not allow me to have constant operator in flat file maps. and the constant for PHONE_COUNTRY column is enclosed in double quotes insted of single quotes.[should be 'Asia' and not ''Asia'']
    can any one tell me why this is heppening?...i also have problem with the READ BUFFER property. which in 10G used to be defulted to '4' but ignored which generating the .ctl but in 11G this property creates READ BUFFERS statement in .ctl....any help in this will be grt.
    Edited by: user591315 on May 12, 2009 7:39 AM

    if you note 11G some how does not allow me to have constant operator in flat file maps. and the constant for >PHONE_COUNTRY column is enclosed in double quotes insted of single quotes.Hi
    Please open the same mapping in 10g R2 its same .
    It use Double code around the column name.
    By the way execute the mapping and then check are you getting desired result.

  • Extracting a flat file from oracle table

    I have moved the knowledge module KIM ISO SQL to FileAppend from the Metadata to my project folder.
    But when I create an interface mapping the oracle table and a flat file on a different unix server, in the drop down menu , it shows only KIM SQL TO SQL and KIM Control Append.It does not show up the SQL to FileAppend knowledge module option.
    What should I do to extract a flat file from oracle table?
    Thanks
    Hima
    Overstock.com

    All IKM in the Drop Down Menu are dependent of the target technology.
    A question, at this interface, is your target table a file ?

  • XML File in External Table - OS error permission denied.

    Hi.
    10g R2, Red Hat Linux
    I'm using the article (see below, taken from http://www.dbazine.com/olc/olc-articles/scardina1 by Mark Scardina) to create an external table where I'd store my XML file.
    So, I
    1. Created a directory xmlfile_dir
    2. Granted access to needed db user
    3. Created the table
    CREATE TABLE relayxml_xt (doc CLOB)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY xmlfile_dir
    ACCESS PARAMETERS
    FIELDS (lobfn CHAR TERMINATED BY ',')
    COLUMN TRANSFORMS (doc FROM lobfile (lobfn))
    LOCATION ('xml.dat')
    REJECT LIMIT UNLIMITED;
    4. mv relay.xml /xmlfile_dir/xml.dat
    When I run SELECT * FROM relayxml_xt I get this:
    Error starting at line 1 in command:
    select * from relayxml_xt
    Error report:
    SQL Error: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file RELAYXML_XT_28773.log
    OS error Permission denied
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    29913. 00000 - "error in executing %s callout"
    *Cause:    The execution of the specified callout caused an error.
    *Action:   Examine the error messages take appropriate action.
    What am I doing wrong?
    Thanks,
    Using External Tables
    Introduced in Oracle9i, Oracle’s external table feature offers a solution to define a table in the database while leaving the data stored outside of the database. Prior to Oracle Database 10g, external tables can be used only as read-only tables. In other words, if you create an external table for XML files, these files can be queries and the table can be joined with other tables. However, no DML operations, such as INSERT, UPDATE, and DELETE, are allowed on the external tables.
    Note: In Oracle Database 10g , by using the ORACLE_DATAPUMP driver instead of the default ORACLE_DRIVER, you can write to external tables. In Oracle Database 10g, you can define VARCHAR2 and CLOB columns in external tables to store XML documents. The following example shows how you can create an external table with a CLOB column to store the XML documents. First, you need to create a DIRECTORY to read the data files:
    CREATE DIRECTORY data_file_dir AS 'D:\xmlbook\Examples\Chapter9\src\xml';
    GRANT READ, WRITE ON DIRECTORY data_file_dir TO demo;
    Then, you can use this DIRECTORY to define an external table:
    CREATE TABLE customer_xt (doc CLOB)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY data_file_dir
    ACCESS PARAMETERS
    FIELDS (lobfn CHAR TERMINATED BY ',')
    COLUMN TRANSFORMS (doc FROM lobfile (lobfn))
    LOCATION ('xml.dat')
    REJECT LIMIT UNLIMITED;
    The xml.dat file follows:
    customer1.xml
    customer2.xml
    If you describe the table, you can see the following definition:
    SQL> DESC customer_xt;
    Name Null? Type
    DOC CLOB
    Then, you can query the XML document as follows:
    SELECT XMLType(doc).extract('/Customer/EMAIL')
    FROM customer_xt;
    Though the query requires run-time XMLType creation and XPath evaluation, this approach is useful when applications just need a few queries on the XML data and don’t want to upload the XML data into database. In Oracle Database 10g, you cannot create external tables that contain pre-defined XMLType column types.
    Message was edited by:
    vi2167

    Your don't have the proper operating system privileges. Be sure that you (=oracle OS user / the OS Linux user that is starting the database) are allowed have read privs on the path and/or file.
    for example...
    chown -Rf /xxxxxxx/xxxx/etc
    ls -l file.xml
    file.xml    oracle:oinstall    rw-rw-rw

Maybe you are looking for

  • How to display "No data for yesterday" in a scheduled report on Webi

    Hi All, In Webi, I am working on scheduling reports and was asked by a user if the scheduled report on Webi can display "No data for yesterday/no orders for yesterday" when the report returns no data due to No Orders submitted or a business holiday.

  • How to create a Macro in excel to store the excel data to Oracle Database

    Hi All Does anyone has created a macro in excel which on being run stores the excel data to Oracle database. In my project I need to create one such macro for updating oracle database with excel data and another for inserting excel records. I tried d

  • What's with Safari 6? Extremely unstable, scrolling lags, typing lags...

    I upgraded to Safari 6 just before (using Software update, I'm using 10.7) and... it's completely unusable. I tried to post this question using Safari but it crashed 4 times, so I'm in Chrome now. (No crash report dialog appeared to report to Apple.)

  • [BGRFC] WS Problem

    HI All, I configured client 000 and other used client to by able to use async connection using WSRM. Now when i send async message to some webservice in sxi_monitor i see this message but status of it is "Released for Processing(WS)" and flag is gree

  • BI Research Bibliography

    Hi We have compiled a Business Intelligence research bibliography which may assist in your research activities.  It can be found at http://www.businessandlaw.vu.edu.au/sap/erpbibliography.asp  If you have articles which can be added please let me kno