External table-> fetch location?

With the help of Oracle 10.2.0.5

An external table is a construction that gives me access SQL to a file.

Is it possible to know the name of the file somehow inside to select? Like to add a column with the name of the file?

example of Pseudo
CREATE TABLE EXT_DUMMY
(
    "RECORDTYPE" VARCHAR2(100 BYTE), 
    "COL1" VARCHAR2(100 BYTE), 
    "COL2" VARCHAR2(100 BYTE), 
    "FILE" VARCHAR2(100 BYTE) 
)
ORGANIZATION EXTERNAL
(
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "IMPORT_BAD_FILE" 
    ACCESS PARAMETERS ( 
             records delimited BY newline 
             FIELDS TERMINATED BY ';' 
             MISSING FIELD VALUES ARE NULL 
               ( RECORDTYPE CHAR
               , COL1 CHAR 
               , COL2 CHAR 
               , FILE CHAR FILLER
               ) 
               ) 
    LOCATION ( 'Testfile1.txt, Testfile2.txt' )
)
    reject limit 10
;
The result might look like this:
RECORDTYPE   COL1       COL2      FILE
SAMPLE           DUMMY    DUMMY Testfile1.txt
SAMPLE           DUMMY1   DUMMY Testfile1.txt
SAMPLE           DUMMY2   DUMMY Testfile1.txt
SAMPLE           DUMMY3   DUMMY Testfile1.txt
SAMPLE           DUMMY1   DUMMY1 Testfile2.txt
SAMPLE           DUMMY1   DUMMY2 Testfile2.txt
SAMPLE           DUMMY2   DUMMY1 Testfile2.txt
I would like to know what file is read a certain rank. Maybe I missed an option in the documentation. In this example, I have two different files as the source for the external table.

Another use case could be that:
If I enable a user to switch the external table to a different file
alter table EXT_DUMMY location ('Testfile3.txt' )
. How do know us which file is read during the select on the table? When UserA's select, perhaps UserB just modified the location before that selection has been started. That's why UserA reads in a different file than expected.

Published by: Sven w. on May 26, 2011 16:48

Published by: Sven w. on May 26, 2011 16:51

Published by: Sven w. on May 26, 2011 17:11

Hi Sven,

I don't know how much we can rely on that, but we will consider the following:

create table test_xt (
  rec_id  number
, message varchar2(100)
)
organization external (
  default directory test_dir
  access parameters (
    records delimited by newline
    fields terminated by ';'
  )
  location (
    'marc5.txt'
  , 'test1.csv'
  , 'test2.csv'
  , 'test3.csv'
  )
);

I always thought that the ROWID doesn't hold much meaning for an external table, but...

SQL> select t.rowid
  2       , dump(t.rowid) as rowid_dump
  3       , regexp_substr(dump(t.rowid,10,9,1),'\d+$') as file#
  4       , t.*
  5  from test_xt t
  6  ;

ROWID              ROWID_DUMP                                                FILE#      REC_ID MESSAGE
------------------ --------------------------------------------------------- ------ ---------- -------------------------------
(AADVyAAAAAAAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,0,0,0,0,0,0,0,0,0     0               1 this is a line from marc5.txt
(AADVyAAAAAAAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,0,0,0,0,0,0,0,0,33    0               2 this is a line from marc5.txt
(AADVyAAAAAAAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,0,0,0,0,0,0,0,0,66    0               3 this is a line from marc5.txt
(AADVyAAAAAAAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,0,0,0,0,0,0,0,0,99    0               4 this is a line from marc5.txt
(AADVyAAAAAEAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,1,0,0,0,0,0,0,0,0     1               1 this is a line from test1.csv
(AADVyAAAAAEAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,1,0,0,0,0,0,0,0,33    1               2 this is a line from test1.csv
(AADVyAAAAAEAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,1,0,0,0,0,0,0,0,66    1               3 this is a line from test1.csv
(AADVyAAAAAEAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,1,0,0,0,0,0,0,0,99    1               4 this is a line from test1.csv
(AADVyAAAAAIAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,2,0,0,0,0,0,0,0,0     2               1 this is a line from test2.csv
(AADVyAAAAAIAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,2,0,0,0,0,0,0,0,33    2               2 this is a line from test2.csv
(AADVyAAAAAIAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,2,0,0,0,0,0,0,0,66    2               3 this is a line from test2.csv
(AADVyAAAAAMAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,3,0,0,0,0,0,0,0,0     3               1 this is a line from test3.csv
(AADVyAAAAAMAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,3,0,0,0,0,0,0,0,33    3               2 this is a line from test3.csv
(AADVyAAAAAMAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,3,0,0,0,0,0,0,0,66    3               3 this is a line from test3.csv
(AADVyAAAAAMAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,3,0,0,0,0,0,0,0,99    3               4 this is a line from test3.csv
(AADVyAAAAAMAAAAAA Typ=208 Len=17: 4,0,0,213,200,0,0,0,3,0,0,0,0,0,0,0,132   3               5 this is a line from test3.csv

16 rows selected
 

Then with a join to EXTERNAL_LOCATION$:

SQL> with ext_loc as (
  2    select position-1 as pos
  3         , name as filename
  4    from sys.external_location$
  5    where obj# = ( select object_id
  6                   from user_objects
  7                   where object_name = 'TEST_XT' )
  8  )
  9  select x.filename,
 10         t.*
 11  from test_xt t
 12       join ext_loc x on x.pos = to_number(regexp_substr(dump(t.rowid,10,9,1),'\d+$'))
 13  ;

FILENAME       REC_ID MESSAGE
------------ -------- --------------------------------
marc5.txt           1 this is a line from marc5.txt
marc5.txt           2 this is a line from marc5.txt
marc5.txt           3 this is a line from marc5.txt
marc5.txt           4 this is a line from marc5.txt
test1.csv           1 this is a line from test1.csv
test1.csv           2 this is a line from test1.csv
test1.csv           3 this is a line from test1.csv
test1.csv           4 this is a line from test1.csv
test2.csv           1 this is a line from test2.csv
test2.csv           2 this is a line from test2.csv
test2.csv           3 this is a line from test2.csv
test3.csv           1 this is a line from test3.csv
test3.csv           2 this is a line from test3.csv
test3.csv           3 this is a line from test3.csv
test3.csv           4 this is a line from test3.csv
test3.csv           5 this is a line from test3.csv
 

Seems to work... assuming that the files are always read in the order specified by the LOCATION parameter and the ID generated actually means what I think it means.

Tags: Database

Similar Questions

  • external table data with several locations pump

    Hello
    I'm on:
    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0 - 64biit
    SunOS 5.10

    I am trying to create a table of data pump external at the same time, with the location of the files previously created using pump.
    This is the same as the example given in step 10-13 here:
    http://docs.Oracle.com/CD/B19306_01/server.102/b14215/et_dp_driver.htm#i1007502

    But when I do this and select all the lines in the resulting table, I get the error:

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-29400: data cartridge error
    KUP-11011: file / < filepath > sys_tables.dmp is not valid for this load operation
    ORA-06512: at "SYS." ORACLE_DATAPUMP', line 52

    Can anyone help?
    Here is a script of what I do...


    create the directory message_archive_dir as ' / your/path/directory "; -change default directory
    -chmod 777 your way

    create the sys_tables table
    external organization
    (type ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ("sys_tables.dmp"))
    AS
    Select object_id, object_type
    of object
    where owner = 'SYS '.
    and object_type = 'TABLE '.
    and rownum < 11;

    create the table sys_indexes
    external organization
    (type ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ("sys_indexes.dmp"))
    AS
    Select object_id, object_type
    of object
    where owner = 'SYS '.
    and object_type = 'INDEX '.
    and rownum < 11;

    Select * from sys_tables
    Union
    Select * from sys_indexes;

    -all 20 rows returned!
    -now I combine the two dmp files in a single table...

    create the table sys_objects
    (
    object_id NUMBER (14).
    object_type VARCHAR2 (30)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ('sys_indexes.dmp', 'sys_tables.dmp')
    );

    Select *.
    of sys_objects
    where rownum = 1;

    -ok returnes one line (one of the dmp files work)
    --Choose so all lines...

    Select *.
    of sys_objects;

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-29400: data cartridge error
    KUP-11011: file / < filepath > sys_tables.dmp is not valid for this load operation
    ORA-06512: at "SYS." ORACLE_DATAPUMP', line 52

    Can you see what I'm doing wrong?

    Any help is greatly appreciated!
    Thank you.

    user9969845 wrote:
    ... Etc...

    TYPE ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ('sys_indexes.dmp', 'sys_tables.dmp')

    Combination dump files

    Files dump populated by different external tables can all be specified in the LOCATION of another external table clause. For example, data from different databases can be unloaded in separate files, and these files can then be included in an external table defined in a data warehouse. This provides an easy way to aggregate data from multiple sources. The only restriction is that the metadata for all external tables is exactly the same. This means that the game characters, time zone, schema name, table name, and column names must match. In addition, the columns must be defined in the same order, and their data types must be identical. This means that after you create the first external table you must remove it so that you can use the same table name for the second outer table. This ensures that the metadata in two dump files is the same and they can be used together to create the external table even.
    8 2

  • External table - interprated as link to a file location

    Hello everyone,

    I'm usigng of external tables for the first time. I using DB version 11.2.0.1.0

    I do the following:

    Create the directory:

    create the directory lip_test_dir as ' / daten/file_test/XML ";



    Create an external table

    CREATE TABLE lip_test (clob data)
    EXTERNAL ORGANIZATION
    (
    TYPE ORACLE_LOADER
    Lip_test_dir default DIRECTORY
    ACCESS SETTINGS
    (
    FIELDS (lobfn TANK CANCEL BY EOF)
    TURNS COLUMN (data FROM lobfile (lobfn))
    )
    LOCATION ("2011103052820853_erp2eip_iteminventory_xml.xml")
    )
    REJECT LIMIT UNLIMITED;


    try to select data:

    Select * from lip_test;

    I get the following error:

    ORA-29913: error in executing ODCIEXTTABLEFATCH legend
    ORA-29400: data cartridge error


    Check the log file shows me that the charger open the xml file and tired to open for each line in the xml file, a new file. Messages are looking like this:

    KUP-04027: Dateinamenprufung nicht been: / daten/file_test/XML / <? XML version = "1.0" encoding = "UTF-8" standalone = 'no '? >
    Fehler beim Öffnen von Datei, daten, file_test, XML / <? XML version = "1.0" encoding = "UTF-8" standalone = 'no '? >
    KUP-04017: BS-message: no such file or directory
    KUP-04065: Fehler beim use LOBFILE as Feld DATEN von
    KUP-04101: Datensatz 1-Datei /daten/file_test/XML/2011103052820853_erp2eip_iteminventory_xml.xml zuruckgewiesen


    If <? XML version = "1.0" encoding = "UTF-8" standalone = 'no '? > is the first line in the XML file and tries to open it as a file.
    This is repeated for each line in the xml file.

    Can someone explain to my why this is happening. I have queryed www for this, but I don #t know what question exectly, so I found no useful result.


    I tried the following:

    Re-create the table and use a text file "test.txt" as location

    CREATE TABLE lip_test (clob data)
    EXTERNAL ORGANIZATION
    (
    TYPE ORACLE_LOADER
    Lip_test_dir default DIRECTORY
    ACCESS SETTINGS
    (
    FIELDS (lobfn TANK CANCEL BY EOF)
    TURNS COLUMN (data FROM lobfile (lobfn))
    )
    LOCATION ("test.txt")*.
    )
    REJECT LIMIT UNLIMITED;


    In the test.txt file I just put the name of the XML file, so the value of the test.txt is

    2011103052820853_erp2eip_iteminventory_xml. XML


    Subsequently I query the table again:

    Select * from lip_test;

    No error just now came up! and the query shows me all the lines of 2011103052820853_erp2eip_iteminventory_xml.xml.

    I expected to see only the name of the file as it is written in test.txt, bt now I get the result that I expect when I put location (2011103052820853_erp2eip_iteminventory_xml.xml).


    Anyone know why this is happening?

    Thanks a lot for your help!

    Best regards from Germany
    Ml «»

    You will need to use the second approach, you mentioned above, with a file "test.txt" separate containing the name of the source.

  • Create an external table to import csv to dynamic action

    Hello

    I'm trying to import data from a csv file into a table. The csv is located on the server and I try to do an external table to copy its contents to the master data table.
    I can't even save the code, without this error:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    ( begin case declare exit for goto if loop mod null pragma raise return select update
    while with <an identifier> <a double-quoted delimited-identifier> <a bind variable>
    << continue close current delete fetch lock insert open rollback savepoint set sql execute
    commit forall merge pipe purge
    It works very well in the SQL Developer.
    CREATE TABLE  "DATA_CSV" 
       (     "C1" VARCHAR2(255), 
         "C2" VARCHAR2(255), 
         "C3" VARCHAR2(255), 
         "C4" VARCHAR2(255), 
         "C5" VARCHAR2(255), 
         "C6" VARCHAR2(255), 
         "C7" VARCHAR2(255), 
         "C8" VARCHAR2(255), 
         "C9" VARCHAR2(255), 
         "C10" VARCHAR2(255), 
         "C11" VARCHAR2(255), 
         "C12" VARCHAR2(255), 
         "C13" VARCHAR2(255), 
         "C14" VARCHAR2(255), 
         "C15" VARCHAR2(255), 
         "C16" VARCHAR2(255), 
         "C17" VARCHAR2(255), 
         "C18" VARCHAR2(255), 
         "C19" VARCHAR2(255), 
         "C20" VARCHAR2(255)
       )
        ORGANIZATION EXTERNAL
        (
          TYPE ORACLE_LOADER
          DEFAULT DIRECTORY FTP_FOLDER
          ACCESS PARAMETERS (
            records delimited BY newline
            fields terminated BY ';'
            optionally enclosed BY '"'
            lrtrim
            missing field VALUES are NULL
          )
        LOCATION ('foo.csv')
        );
    {code}
    
    The server I work on, runs on Apex 4.2.2.
    
    Thanks in advance, for your help
    Skirnir                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

  • external table

    Hello

    I try to get data by using the external table as follows

     create table nfs_acq
     (
      Participant_ID                            char( 3         ),
      Transaction_Type                          char( 2         ),
      From_Account_Type                         char( 2         ),
      To_Account_Type                           char( 2         ),
      Trans_srno                                char( 12        ),
      Response_Code                             char( 2         ),
      PAN_Number                                char( 19        ),
      Member_Number                             char( 1         ),
      Approval_Number                           char( 6         ),
      System_Trace_Number                char( 12       ),
      Transaction_Date                           char( 6        ),
      Transaction_Time                           char( 6        ),
      Merchant_Category_Code                     char( 4        ),
      Card_Acceptor_S_Date                       char( 6        ),
      Card_Acceptor_ID                           char( 15       ),
      Card_Acceptor_t_ID                         char( 8        ),
      Card_Acceptor_t_Location           char( 40       ),
      Acquirer_ID                                char( 11       ),
      Acquirer_Settlement_Date                   char( 6        ),
      Transaction_Currency_code                  char( 3        ),
      Transaction_Amount                         char( 15       ),
      Actual_Transaction_Amount                  char( 15       ),
      Transaction_Acitivity_fee                  char( 15       ),
      Acquirer_Cur_Code                         char( 3         ),
      Acquirer_s_Amount                         char( 15        ),
      Acquirer_Settlement_Fee                    char( 15       ),
      Acquirer_settl_proc_fee                   char( 15        ),
      Tran_Acq_Conv_Rate                        char( 15        )
     )
     --
            ORGANIZATION EXTERNAL
             ( TYPE ORACLE_LOADER
               DEFAULT DIRECTORY HRK_NEW
               ACCESS PARAMETERS
               ( RECORDS fixed 274
           skip 1
             FIELDS (
     --
      Participant_ID                            char( 3         ),
      Transaction_Type                          char( 2         ),
      From_Account_Type                         char( 2         ),
      To_Account_Type                           char( 2         ),
      Trans_srno                                char( 12        ),
      Response_Code                             char( 2         ),
      PAN_Number                                char( 19        ),
      Member_Number                             char( 1         ),
      Approval_Number                           char( 6         ),
      System_Trace_Number                       char( 12       ),
      Transaction_Date                           char( 6        ),
      Transaction_Time                           char( 6        ),
      Merchant_Category_Code                     char( 4        ),
      Card_Acceptor_S_Date                       char( 6        ),
      Card_Acceptor_ID                           char( 15       ),
      Card_Acceptor_t_ID                         char( 8        ),
      Card_Acceptor_t_Location                   char( 40       ),
      Acquirer_ID                                char( 11       ),
      Acquirer_Settlement_Date                   char( 6        ),
      Transaction_Currency_code                  char( 3        ),
      Transaction_Amount                         char( 15       ),
      Actual_Transaction_Amount                  char( 15       ),
      Transaction_Acitivity_fee                  char( 15       ),
      Acquirer_Cur_Code                         char( 3         ),
      Acquirer_s_Amount                         char( 15        ),
      Acquirer_Settlement_Fee                    char( 15       ),
      Acquirer_settl_proc_fee                   char( 15        ),
      Tran_Acq_Conv_Rate                        char( 15        )
     )
                       )
                                 LOCATION ('
           ACQRPKJB110116.mkjb')
          )
     reject limit unlimited
    /
    

    table design

    However

    When I select data from table, I get below error

    ORA-29913: error in executing ODCIEXTTABLEOPEN legend

    ORA-29400: data cartridge error

    KUP-00554: error occurred when parsing the access settings

    KUP-01005: syntax error: found 'minussign': expected an a: 'double-quoted-string, identifier, single-quoted-string '.

    KUP-01007: in column 2 line 4

    29913 00000 - "error in the execution of %s legend".

    * Cause: The execution of the specified legend caused an error.

    * Action: Examine the error messages take appropriate measures.

    This is a sequential I am trying to import

    KJB0403 4643470817234643471601110731336011160111ATM00201 001107001303004213191476009651 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000070000000000000070000000000000000000356000000000070000000000000000000000000000000000000001000000000 CHOWK

    KJB0503 0174520817337281611601110956246011160111ATM00201 001109001320004293932011713114 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000000000000000000000000000000000000000356000000000000000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 0176940817339062491601110957576011160111ATM00201 001109001321004293932011713114 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000050000000000000050000000000000000000356000000000050000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 8653240817340573261601110959156011160111ATM00201 001109001322004722554560104882 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000320000000000000320000000000000000000356000000000320000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 4459000817360340861601111015066011160111ATM00201 001110001326005044372611412016 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000001000000000000001000000000000000000000356000000001000000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 6468820817392369431601111037426011160111ATM00201 001110001335004214090575031872 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000100000000000000100000000000000000000356000000000100000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 9133280817459788951601111119146011160111ATM00201 001111001359006074194560106006 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000600000000000000600000000000000000000356000000000600000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 1985030817481985031601111131596011160111ATM00201 001111001362005360160500127597 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000001000000000000001000000000000000000000356000000001000000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 4400820817484400821601111133216011160111ATM00201 001111001363004213371215519505 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000200000000000000200000000000000000000356000000000200000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 0817491361901601111137166011160111ATM00201 001111001366044135083790012559 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000300000000000000000000000000000000000356000000000000000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 6891010817496562841601111140096011160111ATM00201 001111001368004214090322036455 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000050000000000000050000000000000000000356000000000050000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 1310430817509973121601111147346011160111ATM00201 001111001371004689680028170636 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000001000000000000001000000000000000000000356000000001000000000000000000000000000000000000000001000000000 CHOWK

    KJB0503 0309320817544106971601111206046011160111ATM00201 001112001375005296160001593353 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000000000000000000000000000000000000000356000000000000000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 0322130817546216041601111207116011160111ATM00201 001112001376005296160001593353 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000700000000000000700000000000000000000356000000000700000000000000000000000000000000000000001000000000 CHOWK

    KJB0502 8851180817548851181601111208376011160111ATM00201 001112001377005087530341448208 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000000000000000000000000000000000000000356000000000000000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 0566530817550566531601111209336011160111ATM00201 001112001378005087530341448208 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000420000000000000420000000000000000000356000000000420000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 6943770817556943771601111213006011160111ATM00201 001112001379004214920342912709 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000050000000000000050000000000000000000356000000000050000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 7864780817559532151601111214256011160111ATM00201 001112001380006220180039900075266 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000330000000000000330000000000000000000356000000000330000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 1083880817581341641601111226086011160111ATM00201 001112001382004378990101766440 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000800000000000000800000000000000000000356000000000800000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 4830820817582764451601111226546011160111ATM00201 001112001383006071600100041514 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000700000000000000700000000000000000000356000000000700000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 6286600817597510771601111234376011160111ATM00201 001112001386005326760302103432 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000100000000000000100000000000000000000356000000000100000000000000000000000000000000000000001000000000 CHOWK

    KJB0402 0029180817604353121601111238126011160111ATM00201 001112001389004704560203009224 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000001000000000000001000000000000000000000356000000001000000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 3000000817608080441601111240116011160111ATM00201 001112001390005044339052564987192 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000400000000000000400000000000000000000356000000000400000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 0139290817626145271601111249456011160111ATM00201 001112001396005346800000069646 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000900000000000000900000000000000000000356000000000900000000000000000000000000000000000000001000000000 CHOWK

    KJB0403 1126320817671162161601111313226011160111ATM00201 001113001406005196190081887558 ATM00201TILAK KALYAN THANE MHIN800044 160111356000000000020000000000000020000000000000000000356000000000020000000000000000000000000000000000000001000000000 CHOWK

    Help, please

    External table reference...

    Comments are lines that start with two dashes followed text. Comments must be placed before all access settings, for example:

    access_parameters Clause

    
    The access parameters clause contains comments, record formatting, and field formatting information. The syntax for the access_parameters clause is as follows:
    
    Text description of the illustration et_access_parameter.gif
    
    
    
    

    Comments

    
    Comments are lines that begin with two dashes followed by text. Comments must be placed before any access parameters, for example:
    
    
    --This is a comment
    --This is another comment
    RECORDS DELIMITED BY NEWLINE
    
    
     
    
  • ORA-29913 for external table on Windows 7

    Hello

    Please help with the following problem.

    I installed Oracle 11 g on Windows 7 Pro workstation and have created an external table.

    I'm getting an ORA-29913 when I select.

    What I did is given below.

    create the directory imp_files as 'C:\app\user\admin\orcl\dpdump\'-'C:\orcl_work '.
    ;

    drop table people
    ;
    create table people)
    first name varchar2 (250).
    VARCHAR2 (250) last_name,.
    hire_date date,
    number of salary
    )
    (external) Organization
    type oracle_loader
    the default directory data_pump_dir
    (settings) access
    records delimited by newline
    BadFile data_pump_dir: 'pers1%a_%p.bad' /*'pers.bad'*/
    data_pump_dir log file: "pers1%a_%p.log" /*'pers.log'*/
    fields termintated by ' |'
    missing field values are null
    (first_name, last_name, hire_date 'dd.mm.yyyy' format mask, salary)
    )
    location ("pers_table1.txt")
    )
    reject limit unlimited
    ;

    Hello

    you completed wrongly spelt...

    Try to fix that and try again.

    See you soon,.

    rich

  • error when reading flat file of external table... "ORA-01849: time must be between 1 and 12"

    My question is - is it possible for me to fix this error at the level of external table definition? Please advice

    Here is the data file I am trying to download...

    KSEA | 08-10 - 2015-17.00.00 | 83.000000 | 32.000000 | 5.800000

    KBFI | 2015-08-06 - 15.00.00 | 78.000000 | 35.000000 | 0.000000

    KSEA | 08-10 - 2015-11.00.00 | 73.000000 | 55.000000 | 5.800000

    KSEA | 08-08 - 2015-05.00.00 | 61.000000 | 90.000000 | 5.800000

    KBFI | 2015-08-06 - 16.00.00 | 78.000000 | 36.000000 | 5.800000

    KSEA | 2015-08-07 - 18.00.00 | 82.000000 | 31.000000 | 10.400000

    KSEA | 08-10 - 2015-00.00.00 | 65.000000 | 61.000000 | 4.600000

    KBFI | 08-08 - 2015-07.00.00 | 63.000000 | 84.000000 | 4.600000

    KSEA | 08-10 - 2015-15.00.00 | 81.000000 | 34.000000 | 8.100000

    This is the external table script

    CREATE TABLE MWATCH. MWATCH. WEATHER_EXT ".

    (

    LOCATION_SAN VARCHAR2 (120 BYTE),

    DATE OF WEATHER_DATETIME,

    NUMBER (16) TEMP.

    NUMBER (16) OF MOISTURE,

    WIND_SPEED NUMBER (16)

    )

    EXTERNAL ORGANIZATION

    (TYPE ORACLE_LOADER

    THE DEFAULT DIRECTORY METERWATCH

    ACCESS SETTINGS

    (records delimited by newline

    BadFile "METERWATCH": "weather_bad" logfile 'METERWATCH': 'weather_log '.

    fields ended by ' |' missing field values are null

    (location_san, WEATHER_DATETIME char date_format DATE mask "YYYY-mm-dd - hh.mi.ss", TEMPERATURE, MOISTURE, wind_speed)

    )

    LOCATION (METERWATCH: 'weather.dat')

    )

    REJECT LIMIT UNLIMITED

    PARALLEL (DEGREE 5 1 INSTANCES)

    NOMONITORING;

    Here is the error in the weather_bad which is generated files...

    column WEATHER_DATETIME of 55 error processing in the 1st row to the /export/home/camsdocd/meterwatch/weather.dat data file
    ORA - 01849ther_log.log 55 56 error processing column WEATHER_DATETIME in the row 1 for the /export/home/camsdocd/meterwatch/weather.dat data file
    5756 ORA - 01849ther_log.log: time must be between 1 and 12
    58column WEATHER_DATETIME 57 error during treatment number 2 for the /export/home/camsdocd/meterwatch/weather.dat data file
    59ORA-58 01849: time must be between 1 and 12
    60column WEATHER_DATETIME of 59 error processing 5th for the /export/home/camsdocd/meterwatch/weather.dat data file
    61ORA-60 01849: time must be between 1 and 12
    62column WEATHER_DATETIME of 61 error treatment in line 6 to the /export/home/camsdocd/meterwatch/weather.dat data file
    63ORA-62 01849: time must be between 1 and 12
    64column WEATHER_DATETIME of 63 error treatment in row 7 for datafile /export/home/camsdocd/meterwatch/weather.dat
    65ORA-64 01849: time must be between 1 and 12
    66column WEATHER_DATETIME of 65 error treatment 9 for the /export/home/camsdocd/meterwatch/weather.dat data file online
    67: time must be between 1 and 12

    My question is - is it possible for me to fix this error at the level of external table definition? Please advice

    Yes it is possible.  Let's not your date mask.  You're masking for 12-hour format when your data is in 24-hour format.  Change the mask of your date to be "YYYY-mm-dd-hh24. MI.ss ".  Notice the change in "BOLD".

  • Pretreatment of an external table - table is empty at the end

    Hello

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    "CORE 11.2.0.1.0 Production."

    AMT for Solaris: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    Solaris 10 x 86

    I'm trying to create an external table that first pre-process a file and then the bed. The problem is that, in the end, the outer table is empty even if the read file is not empty.

    First, the table works gunzip on the 'employees.csv.gz' file located in/export/home/oracle/archives and then bed. The file employees.csv.gz exists in the specified location. This is the complete script:

    -This Directory keeps the archived files

    CREATE or REPLACE DIRECTORY arch_dir AS 'archives/export/home/oracle/archives";

    -This directory shows where the command gunzip

    CREATE or REPLACE the bin_dir AS DIRECTORY ' / usr/bin';

    CREATE TABLE emp_exadata

    (

    employee_id NUMBER (22, 0),

    first name VARCHAR2 (20).

    last_name VARCHAR2 (25).

    e-mail VARCHAR2 (25).

    Phone_Number VARCHAR2 (20).

    hire_date DATE,

    job_id VARCHAR2 (10),

    higher wages (22: 2),

    commission_pct NUMBER 22 (2)

    manager_id NUMBER (22, 0),

    department_id NUMBER (22, 0)

    )

    EXTERNAL ORGANIZATION

    (

    TYPE oracle_loader

    Arch_dir default DIRECTORY

    ACCESS SETTINGS

    (

    RECORDS delimited BY NEWLINE

    preprocessor bin_dir: "gunzip".

    end fields BY «»

    missing field VALUES are NULL

    (

    employe_id,

    first name,

    last_name,

    E-mail

    Phone_Number,

    hire_date CHAR date_format DATE mask "dd-mm-yyyy hh24:mi:ss."

    job_id,

    salary,

    commission_pct,

    manager_id,

    department_id

    )

    )

    LOCATION ("employees_exp.csv.gz")

    )

    REJECT LIMIT UNLIMITED;

    When I choose to emp_exadata the result set is empty!

    SELECT * FROM emp_exadata;

    no selected line

    When I look at the db server in the directory /export/home/oracle/archives I see no archived file employees_exp.csv. Here is the result of the first three lines:


    bash - $3.2-3 employees_exp.csv head

    198, Donald, Ollivier, DOCONNEL, 650.507.9833, 21/06/2007 00:00:00, SH_CLERK, 2600, 124, 50,.

    199, Douglas, grant, DGRANT, 650.507.9844, 2008-01-13 00:00:00, SH_CLERK, 2600, 124, 50,.

    200 Jennifer Whalen, JWHALEN 515.123.4444, 17/09/2003 00:00:00, AD_ASST, 4400, 101, 10.

    The end of the lines in the file line is LF (unix style). The encoding is in ANSI format.

    I tried to experiment around, but cannot view records when I select in the external table. Please help me to solve it.

    I also register the generated log file:

    LOG file opened at 01/06/15 16:40:11

    For table EMP_EXADATA field definitions

    Record format DELIMITED BY newline

    Data in file have same "endianness" as platform

    Rows with all null fields are accepted

    Fields of the Data Source:

    EMPLOYEE_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    FIRST NAME CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    LAST_NAME CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    EMAIL CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    PHONE_NUMBER CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    HIRE_DATE TANK (19)

    Day DATE data type, date mask dd-mm-yyyy hh24:mi:ss

    Completed by «,»

    Trim whitespace same as SQL Loader

    JOB_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    SALARY CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    COMMISSION_PCT CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    MANAGER_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    DEPARTMENT_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    You need to carefully examine the description of the PREPROCESSOR option in the chapter of the manual external Tables utility.

    The first point that applies to your question is that the preprocessor must write its data transformed to stdout. To do this with gunzip, you use the - c command line parameter. The second point that applies to your case, in view of the answer to the first point, is that you must write a script shell if your preprocessor requires command line settings.

    Kind regards

    Bob

  • Loading external Table with quotes

    I have a file with fields in the file are as TAB delimiter ~ TAB.

    Example as below:

    QM ~ CD ~ Exzm ~ BMW

    DM ~ BD ~ Exzm ~ BMW

    CREATE TABLE test

    (

    Col_1 VARCHAR2 (100),

    Col_2 VARCHAR2 (100),

    Col_3 VARCHAR2 (100),

    Col_4 VARCHAR2 (100)

    )

    EXTERNAL ORGANIZATION

    (TYPE ORACLE_LOADER

    DEFAULT DIRECTORY 'Test_Report '.

    ACCESS SETTINGS

    (records delimited by '\n'

    CHARACTERSET 'UTF8 '.

    fields terminated by '\t~\t '.

    missing field values are null

    )

    LOCATION ("test.asc")

    )

    REJECT LIMIT UNLIMITED;

    OUTPUT:

    ----------------

    Data loaded in DB, but col_4 data comes from the quotation as below

    col_4

    -------

    "BMW".

    "BMW".

    Note: Col1 - col3 data arrives correctly.

    2807064 wrote:

    A finding on my side.

    I found that the values of Col_4 after inserting into DB with "transport return character" (CHR (13)) at the end of each value as shown below when I copy paste the value in notepad ++ "»

    Example:

    ----------

    "BMW".

    "

    But if I see the file I saw that BMW.

    My question is, in this case the external table loading must fail right? Why is this it is to load data in DB?

    Do you have this file begin life on windows, and then are transferred to * nix to serve an external table?  If so, which explains a lot.  Windows is the standard record delimiter x '0d0a' (Chr (13) 10)  On * nix, it's just x '0A' (10.  When the process of loader is scanning for record delimiter he's just looking for the '0A' x and x'd 0' gets included in the data.

    Two solutions-

    1 - Make sure that the data file is transferred so that the Records delimiters are converted.  It's supposed to to happen with ascii ftp mode, but this week I saw several examples in the House of it does not.

    2. attach your table definition external to seek the delimiter of actual recording instead of the default value of the operating system. == RECORDS DELIMITED BY X '0D0A '.

  • Reg: question of external table-

    Hi Experts,

    I am trying to create and read from an external table, but it raises an error. Please notify.

    Scenario-

    I'm downloading a file of my APEX application that is stored in a BLOB field. Then, comes the following:

    DBMS_LOB.CREATETEMPORARY (v_clob, true);

    -/ / Convert BLOB on the CLOB type

    () DBMS_LOB.converttoclob

    v_clob, v_blob,

    DBMS_LOB. LOBMAXSIZE,

    v_dest_offset, v_src_offset,

    v_blob_csid, v_lang_context, g_msg

    );

    -/ / creating a csv file

    v_temp_filename: = 'apex_ ' | TO_CHAR (sysdate, 'yyyymmddhh24miss') |'. CSV';

    -/ / Put the csv file in the database directory 'APEX_DIR '.

    dbms_xslprocessor.clob2file (v_clob, 'APEX_DIR', v_temp_filename);

    -/ / creating an external table

    v_ext_table: = q'[create table (apex_temp_data_ext)

    C001 varchar2 (4000), c002 varchar2 (4000), c003 varchar2 (4000), c004 varchar2 (4000), c005 varchar2 (4000).

    C006 varchar2 (4000), c007 varchar2 (4000), c008 varchar2 (4000), c009 varchar2 (4000) c010 varchar2 (4000).

    C011 varchar2 (4000), c012 varchar2 (4000), c013 varchar2 (4000), c014 varchar2 (4000), c015 varchar2 (4000).

    C016 varchar2 (4000), c017 varchar2 (4000), c018 varchar2 (4000), c019 varchar2 (4000), c020 varchar2 (4000).

    C021 varchar2 (4000), c022 varchar2 (4000), c023 varchar2 (4000), c024 varchar2 (4000), see c025 varchar2 (4000).

    C026 varchar2 (4000), c027 varchar2 (4000), c028 varchar2 (4000), c029 varchar2 (4000), c030 varchar2 (4000).

    C031 varchar2 (4000), c032 varchar2 (4000), c033 varchar2 (4000), c034 varchar2 (4000), c035 varchar2 (4000).

    c037 varchar2 (4000), c038 varchar2 (4000), c039 varchar2 (4000), C036 varchar2 (4000), c040 varchar2 (4000).

    c042 varchar2 (4000), c043 varchar2 (4000), c044 varchar2 (4000), c041 varchar2 (4000), c045 varchar2 (4000).

    C046 varchar2 (4000), c047 varchar2 (4000), c048 varchar2 (4000), c049 varchar2 (4000), c050 varchar2 (4000)

    )

    (external) Organization

    type oracle_loader

    the default directory apex_dir

    (settings) access

    records delimited by newline

    fields completed by «,»

    surrounded of possibly ' "' and '"' NOTRIM

    missing field values are null

    (

    C001 varchar2 (4000), c002 varchar2 (4000), c003 varchar2 (4000), c004 varchar2 (4000), c005 varchar2 (4000).

    C006 varchar2 (4000), c007 varchar2 (4000), c008 varchar2 (4000), c009 varchar2 (4000) c010 varchar2 (4000).

    C011 varchar2 (4000), c012 varchar2 (4000), c013 varchar2 (4000), c014 varchar2 (4000), c015 varchar2 (4000).

    C016 varchar2 (4000), c017 varchar2 (4000), c018 varchar2 (4000), c019 varchar2 (4000), c020 varchar2 (4000).

    C021 varchar2 (4000), c022 varchar2 (4000), c023 varchar2 (4000), c024 varchar2 (4000), see c025 varchar2 (4000).

    C026 varchar2 (4000), c027 varchar2 (4000), c028 varchar2 (4000), c029 varchar2 (4000), c030 varchar2 (4000).

    C031 varchar2 (4000), c032 varchar2 (4000), c033 varchar2 (4000), c034 varchar2 (4000), c035 varchar2 (4000).

    c037 varchar2 (4000), c038 varchar2 (4000), c039 varchar2 (4000), C036 varchar2 (4000), c040 varchar2 (4000).

    c042 varchar2 (4000), c043 varchar2 (4000), c044 varchar2 (4000), c041 varchar2 (4000), c045 varchar2 (4000).

    C046 varchar2 (4000), c047 varchar2 (4000), c048 varchar2 (4000), c049 varchar2 (4000), c050 varchar2 (4000)

    )

    )

    location ('] ' |) v_temp_filename | " ')

    )

    3 parallel

    reject limit unlimited;] " ;



    immediately run v_ext_table;

    It gives me a generic mistake on the front-end server. But, when I take this external Table as well as the "v_temp_filename", that it is created, but when the SELECTION is fired triggers error:

    ORA-29913: error in executing ODCIEXTTABLEOPEN legend

    ORA-29400: data cartridge error

    KUP-00554: error occurred when parsing the access settings

    KUP-01005: syntax error: found 'distinctive sign': expected an a: "binary_double, types binary_float, comma, date, defaultif, char, decimal, double, float, integer, (, nullif, oracle_date, oracle_number, position, raw, recnum,), unsigned, varchar, varraw, varrawc, varcharc, zoned.

    KUP-01008: the bad ID was: varchar2

    KUP-01007: in column 15 of line 6

    Privilege is already provided - GRANT READ, WRITE on APEX_DIR to APEX_DEV;

    But you should check with DBA on the rwx for the generated 'v_temp_filename' permission.

    Pointers?

    Thank you and best regards,

    Nordine

    (on Oracle 11.2.0.3.0, Apex 4.2.5)

    Try this:

    . . .   E t c...

    -/ / creating an external table

    v_ext_table: = "CREATE TABLE Apex_Temp_Data_Ext

    (

    C001 VARCHAR2 (4000), C002 VARCHAR2 (4000), C003 VARCHAR2 (4000), C004 VARCHAR2 (4000), C005 VARCHAR2 (4000).

    C006 VARCHAR2 (4000), C007 VARCHAR2 (4000), C008 VARCHAR2 (4000), C009 VARCHAR2 (4000), C010 VARCHAR2 (4000).

    C011 VARCHAR2 (4000), C012 VARCHAR2 (4000), C013 VARCHAR2 (4000), C014 VARCHAR2 (4000), C015 VARCHAR2 (4000).

    C016 VARCHAR2 (4000), C017 VARCHAR2 (4000), C018 VARCHAR2 (4000), C019 VARCHAR2 (4000), C020 VARCHAR2 (4000).

    C021 VARCHAR2 (4000), C022 VARCHAR2 (4000), C023 VARCHAR2 (4000), C024 VARCHAR2 (4000), SEE C025 VARCHAR2 (4000).

    C026 VARCHAR2 (4000), C027 VARCHAR2 (4000), C028 VARCHAR2 (4000), C029 VARCHAR2 (4000), C030 VARCHAR2 (4000).

    C031 VARCHAR2 (4000), C032 VARCHAR2 (4000), C033 VARCHAR2 (4000), C034 VARCHAR2 (4000), C035 VARCHAR2 (4000).

    C036 VARCHAR2 (4000), C037 VARCHAR2 (4000), C038 VARCHAR2 (4000), C039 VARCHAR2 (4000), C040 VARCHAR2 (4000).

    C041 VARCHAR2 (4000), C042 VARCHAR2 (4000), C043 VARCHAR2 (4000), C044 VARCHAR2 (4000), C045 VARCHAR2 (4000).

    C046 VARCHAR2 (4000), C047 VARCHAR2 (4000), C048 VARCHAR2 (4000), C049 VARCHAR2 (4000), C050 VARCHAR2 (4000)

    )

    (EXTERNAL) ORGANIZATION

    TYPE Oracle_Loader

    The DEFAULT DIRECTORY Apex_Dir

    (SETTINGS) ACCESS

    RECORDS DELIMITED BY NEWLINE

    FIELDS TERMINATED BY ","

    OPTIONALLY SURROUNDED BY "" "AND" "" NOTRIM

    MISSING FIELD VALUES ARE NULL

    (

    C001 TANK (4000), C002 TANK (4000), C003 TANK (4000), C004 TANK (4000), CHAR C005 (4000),

    C006 TANK (4000), C007 TANK (4000), C008 TANK (4000), C009 TANK (4000), C010 TANK (4000).

    C011 TANK (4000), C012 TANK (4000), C013 TANK (4000), CHAR C014 (4000), C015 TANK (4000),

    C016 TANK (4000), C017 TANK (4000), CHAR C018 (4000), C019 TANK (4000), C020 TANK (4000),

    C021 TANK (4000), C022 TANK (4000), C023 TANK (4000), CHAR C024 (4000), SEE C025 TANK (4000),

    C026 TANK (4000), CHAR C027 (4000), C028 TANK (4000), C029 TANK (4000), C030 TANK (4000),

    C031 TANK (4000), C032 TANK (4000), C033 TANK (4000), C034 TANK (4000), C035 TANK (4000).

    C036 TANK (4000), C037 TANK (4000), C038 TANK (4000), C039 TANK (4000), C040 TANK (4000).

    C041 TANK (4000), C042 TANK (4000), C043 TANK (4000), C044 TANK (4000), C045 TANK (4000).

    C046 TANK (4000), C047 TANK (4000), C048 TANK (4000), C049 TANK (4000), C050 TANK (4000)

    )

    )

    LOCATION('''||) V_Temp_Filename | " ')

    )

    3 PARALLEL

    UNLIMITED RELEASE LIMIT ';

    . . .   E t c...

  • How do I get the number of incorrect records when you use external tables

    Hi all, I have an external table DEPT,.

    DEPT. DAT

    20. ELECTRONICS

    10. SHOES

    30. CAMERA

    Select * from the Department; only 10 and 30 dept will be led as deptdescr for 20 that there are more than 10 in length so this record will go into the wrong file,

    y at - it count any query to display the folder or get any query to get the record to view the entries entries wrong file rather that will drop and see how much is rejected.

    Table:

    CREATE TABLE DEPT
    (
       DEPT        NUMBER,
       DEPTDESCR   VARCHAR2 (10 CHAR)
       )           ORGANIZATION EXTERNAL
      (  TYPE ORACLE_LOADER
         DEFAULT DIRECTORY BATCH_INBOX
         ACCESS PARAMETERS
           ( RECORDS DELIMITED  BY '\r\n'
                  BADFILE  BATCH_BAD:'UPS_DEPT_LOAD_%p.bad'
                  LOGFILE  BATCH_LOG:'UPS_DEPT_%p.log'
                  NODISCARDFILE
        FIELDS  TERMINATED BY '|'
        MISSING FIELD VALUES ARE NULL
    (
    DEPT,
    DEPTDESCR
    )
                                    )
         LOCATION (BATCH_INBOX:'DEPT.DAT')
      )
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    

    You can use the wrong file as the data file for another external table, with the entire line in a single field.  Please see the demo below.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_inbox AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_bad AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_log AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE TABLE DEPT

    2       (

    NUMBER 3 DEPT,

    4 DEPTDESCR VARCHAR2 (10 CHAR)

    (5) ORGANIZATION EXTERNAL

    6 (TYPE ORACLE_LOADER

    7 DEFAULT DIRECTORY BATCH_INBOX

    8 ACCESS SETTINGS

    9 (RECORDS DELIMITED BY "\r\n"

    10 BADFILE BATCH_BAD: 'UPS_DEPT_LOAD.bad'

    11 BATCH_LOG:'UPS_DEPT_%p.log LOGFILE'

    12 NODISCARDFILE

    13 FIELDS TERMINATED BY ' |'

    14 MISSING FIELD VALUES ARE NULL

    15       (

    DEPT 16,

    17 DEPTDESCR

    18       )

    19                       )

    LOCATION 20 (BATCH_INBOX:'DEPT.) DAT')

    21         )

    RELEASE 22 UNLIMITED LIMIT

    23 NOPARALLEL

    24 NOMONITORING;

    Table created.

    Scott@orcl12c > SELECT * FROM dept

    2.

    DEPTDESCR DEPT

    ---------- ----------

    10 SHOES

    CAMERA 30

    2 selected lines.

    Scott@orcl12c > CREATE TABLE DEPT_bad

    2       (

    3 the_whole_row VARCHAR2 (4000)

    (4) ORGANIZATION EXTERNAL

    5 (TYPE ORACLE_LOADER

    6 DEFAULT DIRECTORY BATCH_INBOX

    7 ACCESS SETTINGS

    8 (RECORDS DELIMITED BY "\r\n"

    9 NOLOGFILE

    10 FIELDS TERMINATED BY '\r\n '.

    11. THE MISSING FIELD VALUES ARE NULL

    12       (

    13 the_whole_row CHAR (4000)

    14       )

    15                       )

    16 RENTAL (BATCH_BAD:'UPS_DEPT_LOAD.) THE BAD ")"

    17         )

    RELEASE 18 UNLIMITED LIMIT

    19 NOPARALLEL

    20 NOMONITORING

    21.

    Table created.

    Scott@orcl12c > SELECT * FROM dept_bad

    2.

    THE_WHOLE_ROW

    --------------------------------------------------------------------------------

    20. ELECTRONICS

    1 selected line.

  • External table with the field tab delimiter

    With the help of Oracle 11 g Release 2

    Here is my table create statement external:

    CREATE TABLE global.ext_a_attrib_cmt
    (   tag      VARCHAR2(255)
      , from$    VARCHAR2(255)
      , to$      VARCHAR2(255)
    )
       ORGANIZATION EXTERNAL
    (  TYPE ORACLE_LOADER
       DEFAULT DIRECTORY EXT_DATA_DIR
          ACCESS PARAMETERS
            (  RECORDS DELIMITED BY NEWLINE 
               SKIP 1
               BADFILE EXT_BAD_DIR:'a_attrib_cmt.bad'
               LOGFILE EXT_LOG_DIR:'a_attrib_cmt.log'
           --    FIELDS TERMINATED BY 0X'09' -- TAB delimited  
               FIELDS TERMINATED BY '\t'
               OPTIONALLY ENCLOSED BY "'"
               MISSING FIELD VALUES ARE NULL
               REJECT ROWS WITH ALL NULL FIELDS
            )
          LOCATION ('a_attrib_cmt.txt')
    )
       REJECT LIMIT UNLIMITED
       NOMONITORING
    /
    

    Here is the text file, a_attrib_cmt.txt:

    tagOfTO
    FrontSpringType_idCoilw/FRONT COIL SPRINGS
    FrontSpringType_idSheetthe FRONT/w suspension SPRINGS
    Aspiration_idNaturally aspiratedw/o TURBO
    Aspiration_idTurbochargedw/TURBO
    Aspiration_idSuperchargedw/COMPRESSOR
    SteeringType_idGridw/RACK and PINION STEERING
    SteeringType_idGearw/GEAR STEERING
    FuelDeliveryType_idCARBw/o FUEL INJ
    FuelDeliveryType_idFIw/FUEL INJ
    BedLength_id?" BED
    BodyNumDoors_id? DR
    BrakeSystem_idw / ? BRAKES
    FrontBrakeType_idw/FRONT? BRAKES

    PUBLIC has privileges to write to the directory EXT_DATA_DIR.

    Here is the error I get:

    Globall@ORA1 > select count (*) in the ext_a_attrib_cmt;

    Select count (*) in ext_a_attrib_cmt

    *

    ERROR on line 1:

    ORA-29913: error in executing ODCIEXTTABLEOPEN legend

    ORA-29400: data cartridge error

    KUP-00554: error occurred when parsing the access settings

    KUP-01005: syntax error: found 'minussign': expected an a: "badfile, bigEndian, characterset, column, data, delimited, discardfile,

    disable_directory_link_check, fields, fixed, charge, logfile, language, nodiscardfile, nobadfile, nologfile, date_cache, preprocessor, TailleLue, String, jump,

    territory, variable.

    KUP-01007: line 5, column 8

    Just get rid of the comment line. You cannot cave comments to create external table statement. SY.

  • Battle of external table: files that contain only a picture

    Hello

    Does anyone know if this is possible: use an external table to load files that each contain only one photo (photo) in a BLOB column?

    So: just a photo, not other columns and not many lines.

    I tried, in the sense of this article: ORACLE-DATABASE external Tables containing LOB -

    I'm starting to believe it is not possible due to the "delimited records by ' and 'fields terminated by' clauses, which are not really applicable given files (just a picture), but maybe (hopefully), I'm wrong.

    Any pointer is more than welcome!

    BANNER

    ----------------------------------------------------------------

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

    PL/SQL Release 10.2.0.4.0 - Production

    CORE 10.2.0.4.0 Production

    AMT for HP - UX: release 10.2.0.4.0 - Production

    NLSRTL Version 10.2.0.4.0 - Production

    5 selected lines.

    SQL > drop table photo_ext is serving;

    Deleted table.

    SQL > create table photo_ext

    2 (blob_content blob

    3   )

    4 external organization

    5 (type oracle_loader

    6 default directory tmp

    7 access settings

    8 (records delimited by newline

    9 nobadfile

    10 nologfile

    11 fields completed by «,»

    12 field missing values are null

    (13)

    14 blob_filename tank (100)

    15)

    16 transformations column (lobfile (blob_filename) of the blob (tmp) blob_content)

    17)

    18 rental

    19 ("54618645837_vp3.jpg",

    20 "54618645837_vp4.jpg."

    21 "54618645837_vp2.jpg."

    22 "54618645837_vp1.jpg."

    23 "54618645837.jpg."

    24 "54618636860_vp6.jpg."

    25 "54618636860_vp5.jpg."

    26 "54618636860_vp4.jpg."

    27 "54618636860_vp3.jpg."

    28 '54618636860_vp2.jpg '.

    29       )

    30)

    31 reject limit unlimited;

    Table created.

    SQL > select DBMS_LOB.getlength (blob_content) AS blob_length of photo_ext;

    Select DBMS_LOB.getlength (blob_content) AS photo_ext blob_length

    *

    ERROR on line 1:

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend

    ORA-29400: data cartridge error

    KUP-04001: doing bij openen van bestand/tmp /.

    ORA-06512: at "SYS." ORACLE_LOADER', line 52

    You need for your names to jpg files in a text file, the name of one file per line in the list, then use the name of the text file as your location in your outer table.  In the example below, I've listed just a jpg file bridge.jpg in text file test.dat.

    Scott@orcl12c > host type test.dat

    Bridge.jpg

    Scott@orcl12c > create or replace directory tmp as 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > create table photo_ext

    2 (blob_content blob)

    3 the external organization

    4 (type oracle_loader

    5 by default directory tmp

    6 access settings

    7 (records delimited by newline

    8 nobadfile

    9 nologfile

    10 fields completed by «,»

    11 lack of field values are null

    12 (blob_filename tank (100))

    13 column transformations

    14 (lobfile (blob_filename) of the blob (tmp) blob_content))

    15 rental ("test.dat"))

    release limit 16 unlimited

    17.

    Table created.

    Scott@orcl12c > select DBMS_LOB.getlength (blob_content) AS photo_ext blob_length

    2.

    BLOB_LENGTH

    -----------

    511500

    1 selected line.

  • EXTERNAL TABLE ERROR

    Hello

    I use external table below script

    CREATE TABLE emp_load

    (employee_number VARCHAR2 (50))

    employee_last_name VARCHAR2 (50).

    employee_first_name VARCHAR2 (50).

    employee_middle_name VARCHAR2 (50).

    employee_hire_date VARCHAR2 (50))

    EXTERNAL ORGANIZATION

    (TYPE ORACLE_LOADER

    THE DEFAULT DIRECTORY ABC_LOAD

    ACCESS SETTINGS (FIELDS TERMINATED BY ' |')

    RECORDS DELIMITED BY NEWLINE

    FILED MISSING VALUES ARE NULL

    (employee_number VARCHAR2 (50))

    employee_last_name VARCHAR2 (50).

    employee_first_name VARCHAR2 (50).

    employee_middle_name VARCHAR2 (50).

    employee_hire_date VARCHAR2 (50))

    )

    LOCATION ("info.dat")

    ) REJECT LIMIT UNLIMITED;

    and have created a directory ABC_LOAD as 'C:\Oracle' and my os is WINDOWS 8.

    and the content of my. DAT file is

    010 | ABC | DEF | XYZ | DECEMBER 3, 2011

    but when I do select * from emp_load I get error below.

    ERROR on line 1:

    ORA-29913: error in executing ODCIEXTTABLEOPEN legend

    ORA-29400: data cartridge error

    KUP-00554: error occurred when parsing the access settings

    KUP-01005: syntax error: found 'records': expected an of: "column, locked,

    (', ltrim, lrtrim, ldrtrim, missing, notrim, possibly, rtrim, reject ")

    KUP-01007: line 2, column 9

    I use the Oracle 11 g R2 and Windows as operating system.

    Any help please.

    Thank you.

    1. in the absence of typing in the VALUES LIST FILED ARE NULL

    2 RECORDS DELIMITED BY NEWLINE must precede FIELDS TERMINATED BY ' |'

    3. There is no such SQL * Loader/external VARCHAR2 table field type (in this case, you need not even say)

    SQL > CREATE TABLE emp_load
    2 (employee_number VARCHAR2 (50))
    3 employee_last_name VARCHAR2 (50).
    4 employee_first_name VARCHAR2 (50).
    5 employee_middle_name VARCHAR2 (50).
    6 employee_hire_date VARCHAR2 (50))
    7 EXTERNAL ORGANIZATION
    8 (TYPE ORACLE_LOADER
    9 DEFAULT TEMP DIRECTORY
    10 ACCESS (PARAMETERS
    11 PRECEDED BY NEWLINE RECORDS
    12 FIELDS TERMINATED BY ' |'
    13 MISSING FIELD VALUES ARE NULL
    14 (employee_number,
    15 employee_last_name,
    employee_first_name 16,
    employee_middle_name 17,
    18 employee_hire_date)
    19         )
    20 RENTAL ("info.dat")
    (21) REJECT LIMIT UNLIMITED
    22.

    Table created.

    SQL > SELECT *.
    2 FROM emp_load
    3.

    EMPLOYEE_N EMPLOYEE_L EMPLOYEE_F EMPLOYEE_M EMPLOYEE_HI
    ---------- ---------- ---------- ---------- -----------
    010 ABC DEF XYZ DECEMBER 3, 2011

    SQL >

    SY

  • Key issue of the external table preprocessor - ssh

    I want an external table that runs a df command in a script

    DFH.sh more

    / bin/df h

    CREATE TABLE XT_df

    (

    SCRIPT_OUTPUT VARCHAR2 (2000)

    )

    EXTERNAL ORGANIZATION

    (TYPE ORACLE_LOADER

    Datapumpdir default DIRECTORY

    ACCESS SETTINGS

    (RECORDS DELIMITED BY NEWLINE

    PREPROCESSOR datapumpdir: 'dfh.sh'

    jump 1

    FIELDS TERMINATED BY ', '.

    surrounded of possibly "" "

    )

    LOCATION (datapumpdir: 'xtdf.dat')

    )

    Select * from XT_df

    And it works.  I see my df output.

    I want to run something similar on multiple hosts, but the same host, so I place another table and call another shell script to run a remote ssh script after I have set user equivalence

    / usr/bin/SSH oracle@remotehost1 ' df-h | grep u02'

    the works of shell script

    However, qualifying by selecting in the external table I get ssh host checking has no error.

    [Error] Run (1: 1): ORA-29913: error in executing ODCIEXTTABLEFETCH legend

    ORA-29400: data cartridge error

    KUP-04095: order of preprocessor /winlogs/dfh.sh has detected the error "host key verification failed.

    "

    So what could be the cause that if she works well as oracle from command line, checking the .ssh key is on the other side (I think).

    > Datapumpdir: 'dfh.sh PREPROCESSOR'

    Modify the script above to include the following line as the second line of the script

    env | Tri o /tmp/capture.env

    view the contents of /tmp/capture.env return here after it gets filled

Maybe you are looking for

  • How to recover and archived email?

    I am trying to retrieve emails that I have archived, but my folder properties archives show "0 Emails" and any file size. I had archived them by years and trying to get into the record of 2013, that I created, but it is empty. Is it possible to recov

  • I can't print from the internet, unless I have save to file. This just started happening. Why?

    I think it started after an update. I want to disable the "print to file" when you print on the internet. I would like to know how?

  • How can I get my mail icon to stop bouncing

    I spent my mail yesterday and I deleted a lot of junk mail or spam, and now the mail icon won't stop bouncing. Whenever I click it a message pops up saying "cannot delete this email - google." I tried to restart my computer, but it wont let me becaus

  • Graphics card does not not on my Hp Elite 7300 series MT

    Hello I have a desktop HP Elite 7300 series MT with the following specifications: Card mother Pegatron IPISB-CH2 Core i5 2500 3.3 GHz 6 GB of DDR3 Ram Gigabyte Superb e620 PSU I just bought a powercolor HD7950 PCS + graphics card, but it did not work

  • No list of programs and launch the search does not work.

    Last year a virus creeped into my system. After I couldnot find and delete I ran combofix that seems to help eliminate the virus. However, I have a lot of files and corrupted files in my system that I don't recognize. also, my search for the Start bu