Oracle SQL Loader - External Table

This is my code:-
CREATE TABLE GLO_CUST_EXT
(SOURCE_ID CHAR(3),
BUS_DT CHAR(8),
TRAN_CD CHAR(1),
CUST_CD NUMBER(10),
MNEMONIC CHAR(10),
SHORT_NM CHAR(255))
ORGANIZATION external
(TYPE oracle_loader
DEFAULT DIRECTORY Source_dir
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE Skip 1
badfile bad_dir:'GLO_CUST%a_%p.bad'
LOGFILE log_dir:'GLO_CUST%a_%p.log'
FIELDS TERMINATED BY '|'
(SOURCE_ID ,
BUS_DT ,
TRAN_Cd ,
CUST_CD,
MNEMONIC,
SHORT_NM))
LOCATION ('GBCUS.txt'))
REJECT LIMIT 0;
Question:
Would like how to load the data by selected field?
Example:
I want to all these fields (SOURCE_ID , BUS_DT , TRAN_CD ,
CUST_CD, SHORT_NM) except the MNEMONIC. Thank you.

Mohan Nair,
This is my code:
CREATE TABLE GLO_CUST_EXT5
(SOURCE_ID CHAR(3),
BUS_DT CHAR(8),
TRAN_CD CHAR(1),
CUST_CD NUMBER(10),
MNEMONIC CHAR(10),
SHORT_NM CHAR(255))
ORGANIZATION external
(TYPE oracle_loader
DEFAULT DIRECTORY Source_dir
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE Skip 1
badfile bad_dir:'GLO_CUST%a_%p.bad'
LOGFILE log_dir:'GLO_CUST%a_%p.log'
FIELDS TERMINATED BY '|'
(SOURCE_ID ,
BUS_DT ,
TRAN_Cd ,
CUST_CD,
MNEMONIC FILLER,
SHORT_NM))
LOCATION ('GBCUS.txt'))
REJECT LIMIT 0;
I'm using Oracle 10g. I execute this code using TOAD version 8.5.0.50.
I can create the external table, but when i used simple select statement
(select * from GLO_CUST_EXT5), i got this 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 "identifier": expecting one of: "binary_double, binary_float, comma, char, date, defaultif, decimal, double, float, integer, (, nullif, oracle_date, oracle_number, position, raw, recnum, ), unsigned, varrawc, varchar, varraw, varcharc, zoned"
KUP-01008: the bad identifier was: FILLER
KUP-01007: at line 9 column 10
ORA-06512: at "S
Can you help me solve this problem? Thank you.

Similar Messages

  • SQL LOADER , EXTERNAL  TABLE and ODBS DATA SOURCE

    hello
    Can any body help loading data from dbase file .dbt to an oracle 10g table.
    I tried last day with SQL LOADER, EXTERNAL table , and ODBC data source.
    Why all of these utilities still failing to solve my problem ?
    Is there an efficient way to reach this goal ?
    Thanks in advance

    export the dbase data file to text file,
    then you have choice of using either sql loader or external table option to use.
    regards

  • Comparison of Data Loading techniques - Sql Loader & External Tables

    Below are 2 techniques using which the data can be loaded from Flat files to oracle tables.
    1)     SQL Loader:
    a.     Place the flat file( .txt or .csv) on the desired Location.
    b.     Create a control file
    Load Data
    Infile "Mytextfile.txt" (-- file containing table data , specify paths correctly, it could be .csv as well)
    Append or Truncate (-- based on requirement) into oracle tablename
    Separated by "," (or the delimiter we use in input file) optionally enclosed by
    (Field1, field2, field3 etc)
    c.     Now run sqlldr utility of oracle on sql command prompt as
    sqlldr username/password .CTL filename
    d.     The data can be verified by selecting the data from the table.
    Select * from oracle_table;
    2)     External Table:
    a.     Place the flat file (.txt or .csv) on the desired location.
    abc.csv
    1,one,first
    2,two,second
    3,three,third
    4,four,fourth
    b.     Create a directory
    create or replace directory ext_dir as '/home/rene/ext_dir'; -- path where the source file is kept
    c.     After granting appropriate permissions to the user, we can create external table like below.
    create table ext_table_csv (
    i Number,
    n Varchar2(20),
    m Varchar2(20)
    organization external (
    type oracle_loader
    default directory ext_dir
    access parameters (
    records delimited by newline
    fields terminated by ','
    missing field values are null
    location ('file.csv')
    reject limit unlimited;
    d.     Verify data by selecting it from the external table now
    select * from ext_table_csv;
    External tables feature is a complement to existing SQL*Loader functionality.
    It allows you to –
    •     Access data in external sources as if it were in a table in the database.
    •     Merge a flat file with an existing table in one statement.
    •     Sort a flat file on the way into a table you want compressed nicely
    •     Do a parallel direct path load -- without splitting up the input file, writing
    Shortcomings:
    •     External tables are read-only.
    •     No data manipulation language (DML) operations or index creation is allowed on an external table.
    Using Sql Loader You can –
    •     Load the data from a stored procedure or trigger (insert is not sqlldr)
    •     Do multi-table inserts
    •     Flow the data through a pipelined plsql function for cleansing/transformation
    Comparison for data loading
    To make the loading operation faster, the degree of parallelism can be set to any number, e.g 4
    So, when you created the external table, the database will divide the file to be read by four processes running in parallel. This parallelism happens automatically, with no additional effort on your part, and is really quite convenient. To parallelize this load using SQL*Loader, you would have had to manually divide your input file into multiple smaller files.
    Conclusion:
    SQL*Loader may be the better choice in data loading situations that require additional indexing of the staging table. However, we can always copy the data from external tables to Oracle Tables using DB links.

    Please let me know your views on this.

  • SQL Loader/External Table multiple record delimiters

    Hi every one.
    I have a strange problem, I have an external csv file which i wish to deal with (external tables or sql loader). This csv is totally not organized in structure and it contains records that are mixed together, meaning that some records are delimited by newline characters. So in short, i want to know if I will be able to load the data in this csv separating records by newline character and another character? So is that possible to have multiple record delimiters specified in the same ctl file?

    abohsin,
    I think using the Stream record format would be helful in your case. Please explore that.
    Using stream record option, instead of the default new line, you can specify a user defined record delimiter.
    Check this link.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005509
    Here is what I did. Not the complete answer, but it might be helpful.
    Replace all delimiters witha standard delimiters (in unix)
    sed s/HEAD,/**DLM**/g < test.dat >test2.dat
    sed s/TAIL,/**DLM**/g < test2.dat >test3.dat
    create table t(
      TEXT varchar2(100)
    and Use that delimiter as the standard delimiter.
    load data
    infile "test3.dat" "str '**DLM**'"
    into table T
    TRUNCATE
    fields terminated by 'XXXXX' optionally enclosed by '"'
    TEXT
    sql> select * from t;
    TEXT
    1111,2222,
    4444,5555,
    4444
    1111,3333,
    8888,6666,
    5555
    {code}
    You should also replace new line charecters with '***DLM***'.
    Thanks,
    Rajesh.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

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

  • How to resolve error when Loading External Table?

    I’m getting the following errors when attempting to load External Table -- I've changed the file extension from .csv to .txt to resolve ORA-29913 but error re-occurred. See syntax of External Table below.
    Thanks,
    Carol-Ann
    SQL> desc OWB_COUNTY_TIMEZONE_EXT;
    Name Null? Type
    STATE_CODE VARCHAR2(2)
    COUNTY_CODE VARCHAR2(3)
    TIME_ZONE VARCHAR2(1)
    SQL> select count(*) from OWB_COUNTY_TIMEZONE_EXT;
    select count(*) from OWB_COUNTY_TIMEZONE_EXT
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file owb_county_timezone.log
    OS error Permission denied
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    ++++++++++++++++++++++++++++++++++++++++++++++
    Synatx of External Table:
    WHENEVER SQLERROR EXIT FAILURE;
    CREATE TABLE "OWB_COUNTY_TIMEZONE_EXT"
    "STATE_CODE" VARCHAR2(2),
    "COUNTY_CODE" VARCHAR2(3),
    "TIME_ZONE" VARCHAR2(1))
    ORGANIZATION EXTERNAL (
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY AIMQRYD_AIMP_LOC_FF_MODULE_LOC
    ACCESS PARAMETERS (
    RECORDS DELIMITED BY NEWLINE
    CHARACTERSET WE8MSWIN1252
    STRING SIZES ARE IN BYTES
    BADFILE 'owb_county_timezone'
    DISCARDFILE 'owb_county_timezone'
    LOGFILE 'owb_county_timezone'
    FIELDS
    TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"' AND '"'
    NOTRIM
    MISSING FIELD VALUES ARE NULL
    "STATE_CODE" ,
    "COUNTY_CODE" ,
    "TIME_ZONE"
    LOCATION (
    AIMQRYD_AIMP_LOC_FF_MODULE_LOC:'county_timezone_comma.txt'
    REJECT LIMIT UNLIMITED
    NOPARALLEL

    Hi Carol-Ann,
    The key issue here is
    "KUP-04063: unable to open log file owb_county_timezone.log
    OS error Permission denied".
    Looks like you don't have sufficient system priviliges on Unix.
    This is wat AskTom mentions about it:
    "the directory must exist on the SERVER.
    the concerned user is the "oracle software owner" as far as the OS is concerned.
    oracle must have read write access to this directory
    and the directory must exist on the SERVER (database server) itself."
    Hope this helps.
    Cheers, Patrick

  • Invoking Oracle SQL Loader

    I am looking at doing some re-factoring on data load process for inventory feed. Current process takes over an hour to process the file.
    My thought is to go down this road
    1. Using Oracle SQL Loader - load the inventory data into a temp table
    2. Using a view to create the differences between ATG Inventory repository and what is in the temp table
    3. Using the results to update the ATG Inventory stock levels
    So questions are
    1. Is it possible to call the Oracle SQL Loader from a ATG service component - if so how?
    2. Would it be better/faster/possible to create the difference when loading the temp tables
    3. How to create ATG view?

    user7047382 wrote:
    Hello,
    I am trying to load a CSV file located on my C:\ drive on a WIndows XP system into an 'external table'. Everyting used to work correctly when using Oracle XE (iinstalled also locally on my WIndows system).
    However, once I am trynig to load the same file into a Oracle 11g R2 database on UNIX, I get the following errr:
    ORA-29913: Error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    error opening file ...\...\...nnnnn.log
    Please let me know if I can achieve the same functionality I had with Oracle XP.
    (Note: I cannot use SQL*Loader approach, I am invoking Oracle stored procedures from VB.Net that are attempting to load data into external tables).
    Regards,
    M.R.So your database is on a unix box, but the file is on your Windows desktop machine? So .... how is it you are making your file (on your desktop) visible to your database (on a unix box)???????

  • Installing Oracle SQL loader in Oracel Client

    Hi
    Our Customer does not have SQL Loader in Oracle client
    I want to add Oracle SQL loader to the Oracle Client.
    Is there any solution other than uninstalling the present oracle client and
    re-installing the oracle client with SQL loader
    Regards
    Kandakuru

    Thanks a lot Kristian
    I will try with the oracle universal installer
    Regards
    Kandakuru

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

  • SQL Loader and table views

    I am having a problem updating a large partitioned table through it's appropriate view. Here is the loader file
    LOAD DATA               
    INSERT INTO TABLE test.example               
         (      PROGRAM POSITION(1:4) CHAR,
              DWING_NUMBER     POSITION(6:32) CHAR,
              LAST_ISSUED_REVISION     POSITION(34:35) CHAR,
              TEMP_NUMBER     POSITION(37:43) CHAR,
              CONFIGURATION_ITEM     POSITION(45:45) CHAR,
              LOCATION_CODE     POSITION(47:47) CHAR
    It generates this error:
    SQL*Loader-951: Error calling once/load initialization
    ORA-26018: Column PROGRAM in table test.example does not exist
    There are a few considerations that go along with this, and I am developing a strong disdain for the 2 dba's that are involved. First, this view accesses a large partitioned table, all according to "PROGRAM". Secondly, PROGRAM is called PROG_ID in the main table. I didn't think this was an issue at first, but it seems like it might be part of the problem I'm having. We're running Oracle 9.2.0 here. Any helpful replies will be greatly appreciated. Thanks.

    This is what the view looks like:
    Column / Data Type / Null? / Updatable
    PROGRAM VARCHAR(10) N y
    DWING_NUMBER VARCHAR(28) N y
    LAST_ISSUED_REVISION VARCHAR(2) Y y
    TEMP_NUMBER VARCHAR(7) Y y
    CONFIGURATION_ITEM VARCHAR(1) Y y
    LOCATION_CODE VARCHAR(1) Y y
    The main table that this view grabs data from is identical, except for the fact that PROGAM is PROG_ID. I'm fairly new to doing database work, so if the answer is trivial please spare my self esteem.
    formatting sucks
    vagrantgringo

  • Calling oracle SQL Loader from java program

    Hi,
    I want to insert data into oracle tables from a text files containing fixed length fields. I am using SQLLoader to achieve this. The requirement is to call the SQLLoader within the java program.
    Does anyone know how to call SQL Loader from java program?
    Thanks,
    Varsha

    Simply "exec" the sqlldr program with the parameters you need to pass to it.
    Runtime.exec (........)
    Try to pass all parameters needed including the username and password, and use the option "silent" to avoid output, and the option "log" to have a log file of the modifications that sqlldr has done to the database.

  • SQL Loader Foxpro Table

    Hi,
    I have a dbf (foxpro) table that I need to import into an oracle table, is there a way to use SQL Loader for this? If there is a better way, please recommend.
    Thanks,
    Ed

    If you do not have Foxpro, DBase IV or some other dbase clone to dump that dbf file, you could load into M$ Access and dump to cvs file from there.
    :p

  • ORACLE SQL-Loader

    Hi...
    i am having Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production.
    Question is:
    we have a table 'T' in ABC database.
    we need to load data from txt file to tabel T.
    here the requirement is we need to skip few columns in this process.
    let me go in clear....
    data:
    A,1234,ap,xyz
    B,2345,TN,WER
    C,4567,KA,We
    D,5678,MH,show
    now i want to laod data into T like
    col1, col2, col3
    A, 1234, ap
    B,2345, TN
    i need to skip the data after last comma.(at the same time we should not fill with nulls)
    How come we achieve?
    Thanks,
    Pram

    Try with Filler option in sql loader
    LOAD DATA
    INFILE *
    INSERT INTO TABLE TEST
    Fields terminated by ";" Optionally enclosed by '"'
      ENAME,
      EMPNO FILLER,
      SAL
    BEGINDATA
    "JONES";7566;3405
    "BLAKE";7698;2980
    "CLARK";7782;8000
    "SCOTT";7788;3430
    "KING";7839;6430
    "JONES";7566;3405
    "JONES";7566;3405
    "BLAKE";7698;2980
    "CLARK";7782;8000
    "SCOTT";7788;3430
    "KING";7839;6430
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How  change NLS_NUMERIC_CHARACTERS parameter for load external table

    Hi,
    I use this version:
    OWB 11gR2
    Database 11gR2
    Parameter NLS_NUMERIC_CHARACTERS Database ., Instance ,.
    When I created database with wizard and in this moment I don't set spanish language, later I changed this parameters in instance parameters.
    Now I want load data from a file to external table, but I've an error when I try load data with decimal point.
    why does it use the database parameter instead of instance parameter?
    Is possible to change this parameter?
    Cheers
    Marisol

    At this moment , this is not possible . You can see metalink note ID 268906.1.
    It says:
    Currently, external tables always use the setting of NLS_NUMERIC_CHARACTERS
    +at the database level.+
    Cheers
    Marisol

  • How to remove carraige return from the field while loading external table

    I am facing an issue of not getting rid of carraige returns present in the fileds of the source .csv file while loading the records into external table.
    I had tried using LRTRIM, but it does not help.
    The error I am getting is:
    KUP-04021: field formatting error for field POPULATION_DESCRIPTION
    KUP-04037: terminator not found
    I am pasting one record out of the .csv file which is causing this error as below:
    "Business Card Accounts
    ",123,7 BizCard - Gamers,Control,"Business Card Accounts
    ",75270,75271
    You can see the carraige return in the 1st field as well as 5th field. Filed are separated by commas & eclosed by double quotes.
    Could anybody help on this please?

    Can you copy the file to an external table only version, and then dos2unix it?
    Alternatively, you can use the ACCESS PARAMETERS area in your external table definition to set that your RECORDS DELIMITED BY carriage returns, instead of the default.
    Check out the example here http://www.psoug.org/reference/externaltab.html

Maybe you are looking for

  • Step by step instructions for recovering your system using ThinkVantage Rescue and Recovery

    Official Instructions for using ThinkVantage Rescue and Recovery. Message Edited by carbon_unit on 11-04-2008 03:24 PM T60 2623-D7U, 3 GB Ram. Dual boot XP and Linux Mint. T400 2765-T7U Windows 7 Registered Linux User #160145 FYI: I am not employed b

  • JMS Content Converrsion

    Hi, I am working on a scenario like this. SAPR/3 --->XI3.0 --->JMS Queue. I am sending the order information from SAPR/3 to legacy system which will pick up the file from JMS Queue.The legacy system expects the order data as flat file. I am trying to

  • Depot Returns to Plant ( Business Process - STO Depot to Plant)

    Hi Lakshmipathi, i have a problem in Plant to Depot Returns i am following below procedure for Depot returns to plant Create STO Create Delivery In Background Create Depot Excise Invoice (J1IJ) Billing GR for OutBound Delivery J1IEX - Capture & post

  • How to start oracle policy manager

    Hello all, I don't know how start the oracle policy manager on Linux Plataform, I have installed Oracle 9.2.0.4 on RHEL3, thanks for your help

  • Canon Powershot SX1 IS

    So far I love Aperture 3 but it is a pain that there is still no RAW supper for the Canon Powershot SX1 IS. Will Apple ever add it. It's been out a while now. My wife's 500d has been added and it is newer than the SX1. Come on Apple please.