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

Similar Messages

  • 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.

  • Fields terminated by (SQL loader, external table) question?

    Hello.
    I have a txt file which looks like:
    Columns:
    A..........B.........C...........D.........E..............F.............G...........H
    739.......P.........0002......05........25012006..25012006..5...........data group
    . = space
    There are different number of spaces between columns.
    What must i use in FIELDS TERMINATED BY to import this?
    Thanks.

    So, don't use FIELDS TERMINATED BY, but, as Ino suggested, fixed format, something like
    LOAD DATA
    TRUNCATE INTO TABLE <table name>
    (a position(1:10),
    b position(11:20),
    c position(21:30),
    d position(31:40),
    e position(41:48) date "ddmmyyyy",
    f position(51:58) date "ddmmyyyy",
    g position(61:72),
    h position(73:92))

  • Report question: how to use external table to bring data from excel file?

    i need to import excel data into oracle report, how to do that? thanks.

    Hi... What is the error message you get when using external tables?
    You must create a control center connection in the Connection Explorer.
    I recommend you read this:
    http://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28223/toc.htm
    Look for the following sections:
    - Using External Tables (and the "External Tables versus Flat File Operators" sub section)
    - About Flat File Modules
    - Chapter 16, Deploying Target Systems
    Regards,
    Marcos

  • DATE fields and LOG files  in context with external tables

    I am facing two problems when dealing with the external tables feature in Oracle 9i.
    I created an External Table with some fileds with the DATE data type . There were no issues during the creation part. But when i query the table, the DATE fields are not properly selected though the data is there in the files. Is there any ideas to deal with this ?
    My next question is regarding the log files. The contents in the log file seems to be growing when querying the external tables. Is there a way to control this behaviour?
    Suggestions / Advices on the above two issues are welcome.
    Thanks
    Lakshminarayanan

    Hi
    If you have date datatypes than:
    select
    greatest(TABCASER1.CASERRECIEVEDDATE, EVCASERS.FINALEVDATES, EVCASERS.PUBLICATIONDATE, EVCASERS.PUBLICATIONDATE, TABCASER.COMPAREACCEPDATE)
    from TABCASER, TABCASER1, EVCASERS
    where ...-- join and other conditions
    1. greatest is good enough
    2. to_date creates date dataype from string with the format of format string ('mm/dd/yyyy')
    3. decode(a, b, c, d) is a function: if a = b than return c else d. NULL means that there is no data in the cell of the table.
    6. to format the date for display use to_char function with format modell as in the to_date function.
    Ott Karesz
    http://www.trendo-kft.hu

  • How to ''give'' error for this case of an EXTERNAL TABLE?

    Our external table routine works fine:
    -- We have a csv file with 2 cols.
    -- When we create the table referring the csv it works fine.
    -- Even if the csv has more the 2 cols, the ET command only takes the 2 cols and it works fine.
    -- Now, users are saying that if the csv has more than 2 cols, the ET command should give an error
    I went through the command but cannot find any clause which will do this.
    Is there any other way or workaround?
    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>;
    Is it possible to use the READSIZE?
    Edited by: Channa on Sep 23, 2010 2:28 AM

    -- Now, users are saying that if the csv has more than 2 cols, the ET command should give an error
    I went through the command but cannot find any clause which will do this.
    Is there any other way or workaround?I looked at Serverprocess' sql*loader script and did not see how that would answer your question - how to raise an error if the file has more than 2 columns. If I missed something can Serverprocess explain?
    I can't think of a direct way to do this with your external table either, but there may be indirect ways. Some brainstorming ideas of perhaps dubious usefulness follow.
    Placing a view over the external table can limit results to the first two columns but won't raise an error.
    A pipelined function can read the external table, check for data where there shouldn't be any, and raise an exception when you find data in columns where there should not be any.
    Similarly, you could ditch the external table and use utl_file to read the file, manually parsing and checking the data. LOTS more work but more control on your end. External tables are much easer to use :(
    Or, first load the external table into a work table before the "real" select. Check the work table for the offending data programatically and raise an error if data is where it should not be. You could keep the existing external table and not have to do a lot of recoding.
    Or, also load the data into an otherwise unneeded global temporary table first. Use a trigger on the load to look for the unwanted data and raise an error if offending data is there
    These ideas are boiling down to variations on validating the data before you use it.
    Good luck!

  • Selecting from external table

    Hi,
    I have an external table with 3 data files. How can I define by the select statement from which data file I'd like to select, is it possible at all?
    ( like at partitioned table I can define the partition name in the select statement)
    Is there a limit how many data files can belong to an external table?
    Thanks
    Orsi

    Hi,
    I wasn'rt clear, so I write an example:
    CREATE TABLE ADMIN_EXT_EMPLOYEES
    EMPLOYEE_ID NUMBER(4),
    FIRST_NAME VARCHAR2(20 BYTE),
    LAST_NAME VARCHAR2(25 BYTE),
    JOB_ID VARCHAR2(10 BYTE),
    MANAGER_ID NUMBER(4),
    HIRE_DATE DATE,
    SALARY NUMBER(8,2),
    COMMISSION_PCT NUMBER(2,2),
    DEPARTMENT_ID NUMBER(4),
    EMAIL VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY ADMIN_DAT_DIR
    ACCESS PARAMETERS
    LOCATION ('empxt1.dat', 'empxt2.dat', 'empxt3.dat'')
    I'd like select only from one of the dat files, and my question is if is it posible to do that.
    Thanks

  • Need help in Creating External Tables

    Hi All,
    I have a flat file containing numberic data, CLOB data, and also date columns data. I have to load this flat file data into staging server table using External tables. I have to write a stored procedure in such way creating exteranl tables dynamically. My question or need help from you people is that how to define the external table to load the CLOB data from flat file.
    Thanks,
    Sankar

    The LOCATION clause of an external table specifies the file or files to be read when the table is queried. You can change it to refer to different files without dropping and recreating the table and invalidating all dependent code.
    Regarding DBMS_SQL, yes you can do it the hard way if you prefer.
    Good point about CLOB columns in external tables. Quite possibly they are not supported, but I would have to check the manuals and try some examples.

  • Synonym problem with external table in materialized view

    I have a materialized view that includes selects on two external tables.
    However, no matter how I try to access the external tables, the creation fails with a "Synonym Translation Is No Longer Valid" (ORA-00980) error.
    This happens even when I replace the tablename with the full table name, including the link.
    I can create a view just fine, but if I then try something like CREATE MATERIALIZED VIEW mvw_my_view AS SELECT * FROM vw_my_view (where vw_my_view is the view in question), it still throws the Synonym Translation exception.

    00980, 00000, "synonym translation is no longer valid"
    // *Cause: A synonym did not translate to a legal target object. This
    //         could happen for one of the following reasons:
    //         1. The target schema does not exist.
    //         2. The target object does not exist.
    //         3. The synonym specifies an incorrect database link.
    //         4. The synonym is not versioned but specifies a versioned
    //            target object.
    // *Action: Change the synonym definition so that the synonym points at
    //          a legal target object.It is really, Really, REALLY difficult to fix a problem that can not be seen.
    use COPY & PASTE so we can see what you do & how Oracle responds.

  • External Table Authorization Best practices

    Hi,
    I am working on OBIEE External table Authorization. I am able to successfully implement for one Project (catalog). The field for Authorization table (AuthTable) are
    Windows_ID     Employeeid     Name     EmpEMail     GroupName     Process_ID     Process_Name     Portal_Path
    Here as per requirement a user should see data for a few process. So, I put a column for Process_ID and subsequently I created a INIT block in repository where query are like
    Select 'PROCESS_ID',AuthTable. Process_id
    From AuthTable
    WHERE upper(AuthTable.AD_ID) = upper(':USER')
    Then for User Groups I applied FILTERs for all the tables E.G for every Logical Table I applied Filter
    Dim_Process."Process ID" = VALUEOF(NQ_SESSION."PROCESS_ID")
    I checked data and every thing is correct. But My question is:
    We have many projects/catalog for which Filter Criteria will be different so shall we insert a new column for each criteria in SAME AuthTable or there is any other and better way to maintain it. Because if we maintain one table for all the projects/catalog it will be very messy I would prefer to keep different tables for different projects/catalog as there data marts are different.
    But Problem is for all other session variables we may use different INIT BLOCKS and hence different tables BUT for PORTALPATH there should be only one INIT BLOCK so only for PORTALPATH sake we need to keep every thing in same table ?
    Tell me if I am wrong some where in my understanding or there is a better way to do it.
    Regards
    Saurabh

    Hi,
    Pls refer to this link. Kumar explained it very clearly
    http://obieeblog.wordpress.com/category/obiee/obiee-security/
    Pls award points, if helpful
    Regards,
    Sarat Nallapati

  • ORA-00942 when creating external table under 10g with AQ

    I have an application that runs with AQ. The front-end queues up batch-type
    tasks in a queue. When one particular kind of message is dequeued, it
    initiates a data load. That load requires the creation of an external
    table.
    The schema in question is owned by user BL (bulkload). The queue
    is owned by BLB (bulkload batch), primarily to simplify some of the
    rules needed by the resource manager in order to limit the total CPU
    a batch process can consume. The BLB user has full access to the
    BL schema, along with the following rights:
    CREATE TYPE
    CREATE TABLE
    CREATE SEQUENCE
    CREATE PROCEDURE
    CREATE VIEW
    CREATE SYNONYM
    CREATE SEQUENCE
    ALTER SESSION
    CREATE SESSION
    QUERY REWRITE
    CREATE ANY CONTEXT
    EXECUTE_CATALOG_ROLE
    CREATE MATERIALIZED VIEW
    CREATE ANY DIRECTORY
    DROP ANY DIRECTORY
    The table creation works fine under 9.2.0.8 (our current required
    version). However the application generates an ORA-00942 table or view does
    not exist when run under 10g (10.2.0.1 and 10.2.0.3).
    The following statement is the problem:
    CREATE TABLE bulkload33 (
              field1 VARCHAR2(2000),field2 VARCHAR2(2000),field3 VARCHAR2(2000))
              ORGANIZATION EXTERNAL (
              TYPE oracle_loader DEFAULT DIRECTORY EXT_100
              ACCESS PARAMETERS ( RECORDS DELIMITED BY "\r\n"
              CHARACTERSET 'WE8ISO8859P1'
              BADFILE EXT_100:'bulkload_bad.csv'
              LOGFILE EXT_100:'bulkload_log.csv'
              FIELDS TERMINATED BY ','
              OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS (
              field1 CHAR(2000),field2 CHAR(2000),field3 CHAR(2000),field4 CHAR(2000)))
              LOCATION ('bulkload.csv')
              ) REJECT LIMIT UNLIMITED PARALLEL;
    To clarify, the preceding statement, when handled by the process
    for a queue message, failes with an ORA-00942.
    Note that I can issue the command directly, as BLB or SYS, against
    the BL schema with no problems. Further, as user BLB or SYS, I can do
    the following:
    CREATE OR REPLACE PROCEDURE dotest
    IS
         l_sql varchar2(2000);
    BEGIN
         l_sql := 'CREATE TABLE bulkload33 (
              field1 VARCHAR2(2000),field2 VARCHAR2(2000),field3 VARCHAR2(2000))
              ORGANIZATION EXTERNAL (
              TYPE oracle_loader DEFAULT DIRECTORY EXT_100
              ACCESS PARAMETERS ( RECORDS DELIMITED BY "\r\n"
              CHARACTERSET ''WE8ISO8859P1''
              BADFILE EXT_100:''bulkload_bad.csv''
              LOGFILE EXT_100:''bulkload_log.csv''
              FIELDS TERMINATED BY '',''
              OPTIONALLY ENCLOSED BY ''"'' MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS (
              field1 CHAR(2000),field2 CHAR(2000),field3 CHAR(2000),field4 CHAR(2000)))
              LOCATION (''bulkload.csv'')
              ) REJECT LIMIT UNLIMITED PARALLEL';
         EXECUTE IMMEDIATE l_sql;
    END;
    show errors
    EXEC dotest
    Does anyone have any ideas of why this doesn't work under 10g? Metalink
    has yielded no clues so far.
    Thanks.

    Define "has full access to the BL schema" given that it is impossible to grant access rights, in Oracle, by schema. What was done and how was it done?
    My guess is that the privs were granted in a role, rather than explicitly, as is required for PL/SQL.

  • External table no data

    I created an external table with no errors, but when I try to issue sql on that external table there is no data. Here's a sub-set of my data and the sql used to create the external table. 10.2.0.2 on aix 5.2 64bit.
    "BoxC_SL.lwl"|106|"tzdpship52"|1|1|1/28/2008 0:00:00|12/30/1899 9:56:03|||||
    "Genshp_SL.lwl"|106|"tzdpship52"|1|1|1/28/2008 0:00:00|12/30/1899 9:56:04|||||
    "TRLAB-001B_600.lwl"|126|"\\Ibm1\tzsgprod63"|2|1|1/28/2008 0:00:00|12/30/1899 9:56:08|"14928758"|"89-5425.04"|||
    "PalC_SL.lwl"|106|"tzdpship52"|1|1|1/28/2008 0:00:00|12/30/1899 9:56:11|||||
    "SSCC_SL.lwl"|106|"tzdpship52"|1|1|1/28/2008 0:00:00|12/30/1899 9:56:12|||||
    CREATE TABLE "DMR"."LABELS"
    ( "LABEL_NAME" VARCHAR2(100),
    "PRINTER_NUM" NUMBER,
    "PRINTER_NAME" VARCHAR2(100),
    "QTY" NUMBER,
    "DUPLICATES" NUMBER,
    "PRINT_DATE" DATE,
    "PRINT_TIME" TIMESTAMP,
    "LOT" NUMBER,
    "PART" VARCHAR(25),
    "BATCH" VARCHAR(25),
    "WONUM" NUMBER,
    "ITEM" VARCHAR(25)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY "LISTENER_LOG_DIR"
    ACCESS PARAMETERS
    ( records delimited by newline
    nobadfile
    nologfile
    nodiscardfile
    fields terminated by "|" lrtrim
    missing field values are null
    label_name,
    printer_num,
    printer_name,
    qty,
    duplicates,
    print_date char(8) date_format
    date mask "MM/DD/YY",
    print_time char(8) date_format
    date mask "HH24:MI:SS",
    lot,
    part,
    batch,
    wonum,
    item
    LOCATION
    ( 'AUDIT_001.txt'
    REJECT LIMIT UNLIMITED;
    Table created.
    sys@DMRDEV> select * from dmr.labels where rownum < 10;
    no rows selected
    sys@DMRDEV> select count(*) from dmr.labels;
    COUNT(*)
    0

    Hi,
    Here we go
    SQL&gt; drop table t11;
    Table dropped.
    SQL&gt;
    SQL&gt; create table t11 (
    2 "LABEL_NAME" VARCHAR2(20),
    3 "PRINTER_NUM" NUMBER,
    4 "PRINTER_NAME" VARCHAR2(20),
    5 "QTY" NUMBER,
    6 "DUPLICATES" NUMBER,
    7 "PRINT_DATE" date,
    8 "PRINT_TIME" TIMESTAMP,
    9 "LOT" NUMBER,
    10 "PART" VARCHAR(25),
    11 "BATCH" VARCHAR(25),
    12 "WONUM" NUMBER,
    13 "ITEM" VARCHAR(25)
    14 )
    15 organization external (
    16 type oracle_loader
    17 default directory LISTENER_LOG_DIR
    18 access parameters (
    19 records delimited by 0x'0a'
    20 fields terminated by "|" optionally enclosed by '"'
    21 missing field values are null
    22 (
    23 "LABEL_NAME" ,
    24 "PRINTER_NUM" ,
    25 "PRINTER_NAME" ,
    26 "QTY" ,
    27 "DUPLICATES" ,
    28 "PRINT_DATE" DATE "MM/DD/YYYY",
    29 "PRINT_TIME" char(25) DATE_FORMAT timestamp mask "MM/DD/YYYY HH24:MI:SS",
    30 "LOT" ,
    31 "PART" ,
    32 "BATCH" ,
    33 "WONUM" ,
    34 "ITEM"
    35 )
    36 )
    37 location ('holidays.txt')
    38 )
    39 reject limit unlimited;
    Table created.
    SQL&gt;
    I am displaying the count only since you can query select * from t11 and check.. :-)
    SQL&gt; select count(*) from t11;
    COUNT(*)
    5
    Modify the data like this :- remove *""*
    BoxC_SL.lwl|106|tzdpship52|1|1|01/5/2008|12/30/1899 9:56:03|||||
    Genshp_SL.lwl|106|tzdpship52|1|1|01/28/2008|12/30/1899 9:56:04|||||
    PalC_SL.lwl|106|tzdpship52|1|1|1/28/2008|12/30/1899 9:56:11|||||
    SSCC_SL.lwl|106|tzdpship52|1|1|1/28/2008|12/30/1899 9:56:12|||||
    TRLAB-001B_600.lwl|126|\\Ibm1\tzsgprod63|2|1|1/28/2008|12/30/1899 9:56:08|14928758|89-5425.04|||
    Satisfied... Answered question correctly.. ;-)
    - Pavan Kumar

  • External table issue.

    HI all,
    --External table and bad table structures
    CREATE TABLE EXT_APISEARCH_RESULT
        LINENUMBER       NUMBER(20,0),
        USERID           VARCHAR2(15 BYTE),
        NAMESPACE        CHAR(2 BYTE),
        ACCTNUM          VARCHAR2(10 BYTE),
        APC              VARCHAR2(50 BYTE),
        SESSIONID        VARCHAR2(65 BYTE),
        REQUESTDATETIME  VARCHAR2(19 BYTE),
        RESPONSEDATETIME VARCHAR2(19 BYTE),
        APITRANSNAME     VARCHAR2(50 BYTE),
        HDLNORGN         VARCHAR2(20 BYTE),
        ADDNLORGNDATA    VARCHAR2(250 BYTE),
        SRCHMODE         VARCHAR2(30 BYTE),
        SRCGENRE         VARCHAR2(1000 BYTE),
        PARTCODES        VARCHAR2(1000 BYTE),
        SEARCHLANGCODES  VARCHAR2(250 BYTE),
        SNIPPETTYPE      VARCHAR2(20 BYTE),
        BLACKLISTKEYWRDS VARCHAR2(1000 BYTE),
        CONTIND          VARCHAR2(5 BYTE),
        DATERANGE        VARCHAR2(10 BYTE),
        DAYSRANGE        VARCHAR2(50 BYTE),
        DUPLICATIONMODE  VARCHAR2(10 BYTE),
        SORTBY           VARCHAR2(50 BYTE),
        HDLNDISPREQ      VARCHAR2(50 BYTE),
        RSLTSOFFSET      VARCHAR2(10 BYTE),
        SUCCESSIND       VARCHAR2(2 BYTE),
        ERRORCODE        VARCHAR2(20 BYTE),
        RESPONSEFORMAT   VARCHAR2(50 BYTE),
        EPVALUE          VARCHAR2(3000 BYTE),
        APCU             VARCHAR2(20 BYTE),
        TOTALHDLNS       NUMBER(10,0),
        UNIQUEHDLNS      NUMBER(10,0),
        DUPHDLNS         NUMBER(10,0)
      ORGANIZATION EXTERNAL
        TYPE ORACLE_LOADER DEFAULT DIRECTORY EXT_TAB_DIR ACCESS PARAMETERS ( RECORDS DELIMITED BY '\n' BADFILE 'EXT_TAB_DIR_LOG':'SEARCHRESULTAPI.BAD' LOGFILE 'EXT_TAB_DIR_LOG':'SEARCHRESULTAPI.LOG' DISCARDFILE 'EXT_TAB_DIR_LOG':'SEARCHRESULTAPI.DSC' FIELDS TERMINATED BY '#|#' OPTIONALLY ENCLOSED BY '#$'
      AND '$#' MISSING FIELD VALUES ARE NULL( LINENUMBER, USERID, NAMESPACE, ACCTNUM, APC, SESSIONID, REQUESTDATETIME, RESPONSEDATETIME, APITRANSNAME, HDLNORGN, ADDNLORGNDATA, SRCHMODE, SRCGENRE CHAR(1000), PARTCODES CHAR(1000), SEARCHLANGCODES , SNIPPETTYPE, BLACKLISTKEYWRDS CHAR(1000), CONTIND, DATERANGE, DAYSRANGE, DUPLICATIONMODE, SORTBY, HDLNDISPREQ, RSLTSOFFSET, SUCCESSIND, ERRORCODE, RESPONSEFORMAT, EPVALUE CHAR(3000), APCU, TOTALHDLNS, UNIQUEHDLNS, DUPHDLNS ) ) LOCATION ( 'SEARCHRESULTAPI.dat' )
      REJECT LIMIT UNLIMITED;
    --DROP TABLE EXT_BAD_APISEARCH_RESULT; 
    CREATE TABLE EXT_BAD_APISEARCH_RESULT
        BADRECORD VARCHAR2(1000 BYTE)
      ORGANIZATION EXTERNAL
        TYPE ORACLE_LOADER DEFAULT DIRECTORY EXT_TAB_DIR_LOG ACCESS PARAMETERS ( RECORDS DELIMITED BY '\n' NOBADFILE NOLOGFILE NODISCARDFILE FIELDS TERMINATED BY '\n' MISSING FIELD VALUES ARE NULL( BADRECORD CHAR(1000) ) ) LOCATION ( 'SEARCHRESULTAPI.BAD' )
      REJECT LIMIT UNLIMITED;Eventhough there is no space in the BAD file mentioned in the external table it is getting created with space. uDe to which BAD recorsd are not being moved to external bad table (2nd table) hence file processing is failing.
    --Getting created with space.
    'EXT_TAB_DIR_LOG':' SEARCHRESULTAPI.BAD'Please note that, external bad table is getting created without any space in the bad file mentioned.
    Anything wrong with first table script ? Please let us know.
    Thanks and Regards
    Nagaraja akkivalli.
    Edited by: Nagaraja Akkivalli on Jun 13, 2012 10:09 AM

    Please do the following statements.
    -- Execute the below statements.
    create or replace directory EXT_TAB_DIR as '<Point to some location in server>';
    create or replace directory EXT_TAB_DIR_LOG as '<Point to some location in server>';
    Example:
    create or replace directory EXT_TAB_DIR_LOG as '/var/factiva/ODS/log';
    -- Perform the below steps.
    1. Execute both create table statements mentioned above.
    2. Once table's are created then click on the table from SqlDeveloper.
    3. Next, click on SQl tab where we can see the create table statement.
    Now, check the below part in the create table statement.
    'EXT_TAB_DIR_LOG':' SEARCHRESULTAPI.BAD'There is space before SEARCHRESULTAPI.BAD.
    My question is,
    How did this space got inserted eventhogh there is no space in the create table statement ??
    Please let me know if you are still not able to understand my question. I will re-phrase again.

  • Position in external table

    We have excel spread sheet.
    We wanted to load data from excel spread sheet to Oracle via external table.
    I saved my file into .txt format.
    No I need to create external table in oracle DB.
    my question is as follows:
    Do I need to define exact lenght of datatype per data?
    Now data of column city take 16 slots in data file.
    But I defined size 30, is it ok?
    SQL>CREATE TABLE External_City
    CITY VARCHAR2(30),
    STATE VARCHAR2(20),
    ZIP VARCHAR2(10),
    COUNTRY VARCHAR2(30)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DATALOAD
    ACCESS PARAMETERS
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ‘,’
    MISSING FIELD VALUES ARE NULL
    LOCATION (’city_comma.txt’)
    REJECT LIMIT UNLIMITED;
    Do we need to define data position in external table?

    I do not think it has to do with your data or positon of data in it. I am not sure what or where your file is. You need to ensure accessibility to it. it is not seeing the file at all.
    BTW - avoid using udump location as your directory location. Change the directory location (I am not saying it is the cause).
    Here is my test. Although my class.dat file is empty, it shows that your external table should work once your file and directory is accessible. I have only replaced DATALOAD with mytest_dir
    testdb@DBMSDIRECT01:/export/home/oracle/dbmsdirect/test:touch class.dat
    testdb@DBMSDIRECT01:/export/home/oracle/dbmsdirect/test:sqlplus /nolog
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon May 19 15:34:55 2008
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> connect testuser
    Enter password:
    Connected.
    SQL> create or replace directory mytest_dir as '/export/home/oracle/dbmsdirect/test';
    Directory created.
    SQL>
    SQL>
    SQL> create table external_class
      2  (
      3  item_no number(10),
      4  class varchar2(255),
      5  level_date date,
      6  note varchar2(4),
      7  sched_level varchar2(10),
      8  min_range number(12),
      9  max_range number(14)
    10  )
    11  ORGANIZATION EXTERNAL
    12  (
    13  TYPE oracle_loader
    14  DEFAULT DIRECTORY mytest_dir
    15  ACCESS PARAMETERS (
    16  RECORDS DELIMITED BY NEWLINE
    17  FIELDS TERMINATED BY ','
    18  MISSING FIELD VALUES ARE NULL
    19  REJECT ROWS WITH ALL NULL FIELDS
    20  (item_no, class, level_date, note,sched_level,min_range,max_range)
    21  )
    22  LOCATION ('class.dat')
    23  )
    24  PARALLEL
    REJECT LIMIT 0;
    25
    Table created.
    SQL> desc external_class
    Name                                      Null?    Type
    ITEM_NO                                            NUMBER(10)
    CLASS                                              VARCHAR2(255)
    LEVEL_DATE                                         DATE
    NOTE                                               VARCHAR2(4)
    SCHED_LEVEL                                        VARCHAR2(10)
    MIN_RANGE                                          NUMBER(12)
    MAX_RANGE                                          NUMBER(14)
    SQL>
    SQL> select * from external_class;
    no rows selected
    SQL>
    SQL> ho rm class.dat
    SQL>
    SQL> select * from external_class;
    select * from external_class
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file class.dat in MYTEST_DIR not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    SQL>
    SQL> ho touch class.dat
    SQL>
    SQL> select * from external_class;
    no rows selected
    SQL>
    SQL>
    SQL> col DIRECTORY_PATH format a50
    SQL> set lines 200
    SQL> select * from dba_directories where DIRECTORY_NAME = 'MYTEST_DIR';
    OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH
    SYS                            MYTEST_DIR                     /export/home/oracle/dbmsdirect/test
    SQL>

  • Directory selection in external table

    How do we select the directory path for external table files?.whether we can select any directory in any drive or we have to select particular drive and particular directory path?.how do we check for this?.
    example
    create or replace directory ext_dir as 'c:/temp';
    or
    create or replace directory ext_dir as 'd:/temp';
    any procedure for that for selecting drive and directory?.any read or wrte permission is needed?

    Hi,
    any procedure for that for selecting drive and directory?Not really clear to me what you mean by that?
    any read or wrte permission is needed?For external tables, READ privileges are required on directory objects that contain data sources, while WRITE privileges are required for directory objects containing bad, log, or discard files.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2462
    Just check the docs, I bet your questions will be answered while you read:
    http://www.oracle.com/pls/db102/homepage
    or
    http://www.oracle.com/pls/db111/homepage

Maybe you are looking for

  • FB01 posting.

    Hi Guys, I am from SD back ground I have requirements for FI posting using FB01. Now we have thought of using user Exist to do the following before posting FB01 for on particular company code, Say X. 1.If the net due date falls in mid of the month (1

  • ABAP PROXY CONNECTION TO SAP/XI

    Hi, I have the following scenery: Abap Proxy -> XI->RFC.  This abap proxy is installed in the enviroment R/3 in the client 041 and client 210.  In the client 041 it is executed with success. In the customer 210 when I execute the program abap a login

  • Macbook Pro (mid 2012) inbuilt Track pad behaving erratically after fresh install of Yosemite 10.10.2

    I recently did a fresh install of the OS from online recovery. Mountain Lion was installed which I immediately upgraded to Yosemite 10.10.2. The trackpad started behaving erratically after two days. I seems that it started since I plugged one of my w

  • Slideshow - Stills/Audio Not Exporting Correctly

    I have a problem with a slideshow project I've been working on for a few days in Premiere Elements 10. First, my system: Dell Studio XPS 9100 Intel Core i7 @ 2.67Ghz 12Mb DDR3 SDRAM (1333Mhz) ATI Radeon HD 5800 video card 1GB RAM Windows 7 64Bit 750G

  • What's the best, fastest way to obtain a Iphone 4 now.

    I was going to wait until march to get iPhone 4 because I would have to pay 499 or 399 for the phone up until march. My wife can upgrade now for 199 even though we bought the phones the same day. Anyways things changed yesterday when I sold my 3GS fo