SQL Loader help required

HI team,

I need to load data in to table using sqlloader, as I'm going to level three (header, detail, end "")
the first two positions of the data file representing the level as
00-header
01 to 98 - retail
99 - trailer
each level has different data structure and we need to insert in the same table
I created the table as

CREATE TABLE APPLICATIONS. XXD_TEST1
(
THE AA NUMBER,
TEST12 VARCHAR2 (10 BYTE),
testdt VARCHAR2 (10 BYTE),
testtr VARCHAR2 (10 BYTE),
NUMBER OF RECORD_ID
)

and a sequence created to record_id column
-CREATE SEQUENCE APPLICATIONS. XXD_TEST1_S

I have data in the data file as below, I want to load the data in the same order
-------------------------------------
000012
010012
010012
020012
030012
990012
000013
010013
020013
030013
990013

I was using the folowwing control file
-----------------------------------
DOWNLOAD THE DATA
Test INFILE
ADD
IN THE TABLE xxd_test1
WHEN (1:2) = '00'
TRAILING NULLCOLS
(
Test12 POSITION(3:6) CHAR,
AA POSITION(1:2) INTEGER EXTERNAL "lpad(:aa,2,'0')."
record_id 'xxd_test1_s.nextval '.
)
IN THE TABLE xxd_test1
WHEN (1:2)! = '99' and (1:2)! = '00'
TRAILING NULLCOLS
(
testdt POSITION(3:6) CHAR,
AA POSITION(1:2) INTEGER EXTERNAL "lpad(:aa,2,'0')."
record_id 'xxd_test1_s.nextval '.
)
IN THE TABLE xxd_test1
WHEN (1:2) = '99'
TRAILING NULLCOLS
(
testtr POSITION(3:6) CHAR,
AA POSITION (1:2) INTEGER EXTERNAL,
record_id 'xxd_test1_s.nextval '.
)

But it was inserted in the following order

-----------------------------------------
000012
000013
010012
010012
020012
020013
030012
030013
990012
990013

Please help me with the solution.

Thank you
Sriram.

[Double wire | http://forums.oracle.com/forums/thread.jspa?threadID=979069&tstart=0]

Tags: Database

Similar Questions

  • SQL Loader Help in 10g

    Hello

    Is it possible to abort the sql loader with force when a value is not present? I have data like this file

    1. XXX123 | XXX | 20121121 |
    4. XXX123 | XXX |
    5. XXX123 | XXX | 1.
    5. XXX123 | XXX | 2.
    5. XXX123 | XXX |
    9. XXX123 | XXX |

    Model:
    record type | Batch number. lot desc | date | detail line num | other

    1,4,5,9 are the types of records, if you see this line 5. XXX123 | XXX | 1| .. 1 represents a number of detail line, my requirement is if the number of detail line is null for the record type 5 then I want to abort the sqlloader.

    Is this possible?

    Published by: 940838 on November 21, 2012 23:54

    940838 wrote:
    I think that I am not clear in my requirement...

    The question was how to abort the charger if the number of detail line is not present in the record type 5. It is, however, normal detailing line num is not required for other types of records. points of view.

    Hello

    you were clear, and I did a quick test. Unfortunately you can not do this check in SQL * Loader as the WHEN in the control file clause allows not just GOLD.

    Even if you add this check using a constraint in your table and specify the maximum number of errors to 0, SQL * Loader will load the files until this error.

    Let me show you an example:

    (1) create a table with a constraint that, for record_type detail_line_number 5, may not be null.

    CREATE TABLE test
    (
       record_type    INTEGER
     , batch_number   VARCHAR2 (10)
     , batch_desc     VARCHAR2 (10)
     , batch_date     DATE
     , detail_line_num INTEGER
     , other          VARCHAR2 (10)
    );
    
    ALTER TABLE test
      ADD CONSTRAINT check_rec_5
         CHECK (   record_type = 5 AND detail_line_num IS NOT NULL
                OR record_type != 5) ENABLE;
                
    

    In this table, you will not be able to load lines with a record_type = 5 and NULL detail_line_num as this will be considered an error.

    We will prepare your input file:

    1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX|||
    5|XXX123|XXX|||
    9|XXX123|XXX|||
    1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|
    5|XXX123|XXX|||
    9|XXX123|XXX|||1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|
    5|XXX123|XXX|||
    9|XXX123|XXX|||1|XXX123|XXX|20121121||
    4|XXX123|XXX|||
    5|XXX123|XXX||1|
    5|XXX123|XXX||2|
    

    As you can see that the input file has the fourth line with record_type = 5 and detail_line_num NULL. It is a mistake of the constraint.

    Here I used the control file:

    --test.ctl
    load data
    INFILE 'test.dat'
    APPEND
    INTO TABLE test
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS
    (
     record_type     ,
     batch_number    ,
     batch_desc      ,
     batch_date      Date 'YYYYMMDD',
     detail_line_num ,
     other
    )
    

    If I try to run the SQL * Loader and ask to stop at the first error in this way:

    sqlldr userid=yourname/yourpass@yourdb control=test.ctl errors=0 rows=100
    

    SQL * Loader performs only 3 folders because it encounters an error in line 4 and having specified errors = 0 will not continue to load. In fact, the process will continue until she reached the point of validation (in this case 100 lines), but it is not loading any record after the error, or continue to read the file.

    So, if I check the table

    SELECT * FROM test;
    
    RECORD_TYPE BATCH_NUMBER BATCH_DESC BATCH_DATE            DETAIL_LINE_NUM OTHER
    ----------- ------------ ---------- --------------------- --------------- ----------
              1 XXX123       XXX        21-11-2012 00:00:00
              4 XXX123       XXX
              5 XXX123       XXX                                            1           
    

    You will only see the records until you have reached the error.

    This can be avoided, as documented in SQL * Loader manual reference:

    Load interrupted because they exceeded the maximum number of errors


    If the maximum number of errors is exceeded, SQL * Loader stops loading documents in any table and the work accomplished so far is committed.

    As you can see SQL * Loader to interrupt the treatment, but it engage in any case files until this error.

    Another solution is to create an external table in Oracle and do all the checks you want before you copy your table in a database table, as suggested BluShadow.

    Kind regards.
    Al

  • SQL Loader: Help TRIM and Decode functions please

    Hello

    I have load data from a flat file, for some columns, I need to use the TRIM and DECODE functions. It's a pipe delimited file.

    I get a syntax error (one is lower) same error listed for GARNISH.

    SQL * Loader-350: at line xx syntax error.
    Expected ', 'or') ', found 'DECODE '.


    ===========
    , FINAL_BILL_DATE CHAR (30) "TRIM(:FINAL_BILL_DATE)".
    , BUSINESS_ID 'DECODE(:BUSINESS_ID,'B',1,'C',2,'E',3,'G',4,'O',5,'R',6,'T',7,'U',8,'H',9,-1) '.


    Can someone please help.

    Thank you
    Josiane

    Hello josiane.
    The error you receive leads me to believe that at some point before the DECODING on the BUSINESS_ID line, probably some line before the FINAL_BILL_DATE line, it is a syntactic error causing the quotes before DECODING actually put an end to some other syntaxes. Without any lines that might actually contribute to this, including details of the header, it's the best I can advise.

    Hope this helps,
    Luke

    Please check the answer as helpful or response, if it is so. If this is not the case, further clarification.
    Try to always provide create table and table insert to help members of the forum to help you.

  • SQL LOADER HELP

    I need to write the file to control for the following requirement.

    I have data like this

    1. ABC | XYZ | 123
    2. ABC1. XYZ1


    I have two tables (tb1_col1, tb1_col2, tb1_col3) tb1 and tb2 (tb2_col1, tb2_col2)

    I need to insert the data into two different tables according to the condition:

    If the first new line char is 2 then insert into tb2 table with values xyz1 and abc1 in the columns tb2_col1, tb2_col2
    Otherwise, if it's 1 insert then abc, xyz, 123 in tb1 with the values in the columns tb1_col1, tb1_col2, tb1_col3

    I got reallyl grateful if someone can help out me. Thanks in advance

    With the help of 'external tables' in this scenario would be really useful in this scenario, if you ask me.

    What is the version of database?

    Select * from version of v$.

    As you do using the external table is:

    You can define an external table on the file, then

    Insert into table1
    Select * from your_external_table_name
    where first_column = 1;

    Insert into table2
    Select some_columns from your_external_table_name
    where first_column = 2;

  • Pls help: SQL Loader support only a single record

    Hello!!!

    I'm trying to insert data into a table using SQL Loader.

    I entered on the command line,

    > sqlldr userid = abc\abc control = "contrl_file_name.ctl."

    It does not perform any operation and simply crashes... table does no data... no data in the log file...

    It simply shows the SQL Loader Release... production... Copyright messages and do not stop.

    Am new on SQL loader... Kindly help

    *************************************************************

    Another problem:

    I have my file loading_data.dat with multiple entries as below which are records to be inserted for a single column in my table.

    233207332711 < EOFD > < EORD > 233208660745 < EOFD > < EORD > 233200767380 < EOFD > < EORD >...

    My control file is like this:

    data continue_load

    INFILE loading_data.dat '.

    Insert

    in table T1

    fields terminated by '< EOFD > < EORD >.

    (msisdn)

    When I execute the following statement of sqlldr, he inserts a single record and says loading completed - logical number of records 1.

    Why my other documents are not get inserted?

    Post edited by: 3cd7ad85-b56c-4a9c-ae91-83be047aac2c

    Continue_load can only be used with direct path, unconventional path.  You must specify the record terminator and terminator of field, which is the same when your data are only a single column.  Please see the example below.  As for your digital problem, as you can see, it does not reproduce below.  Your problem could be due to many things.  He might try to read something else that what you think, he tries to read, because of something else being wrong.  It is possible that you need to use:

    (msisdn "to_number (ltrim (rtrim (: msisdn)))")

    to remove the leading and trailing spaces and convert it to a number.  You must provide a copy and pasting a full example, as I did below.

    -loading_data.dat content:

    233207332711 233208660745 233200767380

    -control_file_name.ctl:

    load data

    INFILE loading_data.dat "str"".

    Insert

    in table T1

    fields terminated by ' '.

    (msisdn)

    Scott@orcl12c_11gR2 > create table t1 (msisdn number)

    2.

    Table created.

    Scott@orcl12c_11gR2 > host sqlldr scott/tiger control = control_file_name.ctl log = test.log

    Scott@orcl12c_11gR2 > numLargeur 20 the value

    Scott@orcl12c_11gR2 > select * from t1

    2.

    MSISDN

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

    233207332711

    233208660745

    233200767380

    3 selected lines.

  • License is required for Sql Loader?

    I find that Sql Loader could save a lot of time for me in bulk insertion.

    But I do not know if the license is required for use in the development of commercial software.
    Or is there an API that can provide similar features of Sql Loader?

    I think sqlloader is a standard utility and it is included in the price of SE.

    You can see the details at http://www.oracle.com/technetwork/database/database10g/overview/twp-general-10gdb-product-family-132973.pdf

  • Need help with SQL Loader

    I have a third-party site that transforms the information into a csv summary. I can't change the format, and they are not ready to give directly from db and db, so I try and then import it. I'm trying to use SQL Loader, but I can't seem to make it work. I looked in the documentation (VERY rare examples) as well as several websites and I can't find anything that can help out me.

    Control file:
    LOAD DATA
    INFILE 'Daily_Diagnostics_test.csv'
    BADFILE 'Diag_failed.csv'
    APPEND
    INTO TABLE ROAD_DIAGS
    FIELDS TERMINATED BY ","
    --WHEN VEHICLE != 'Vehicle' AND VEHICLE != 'Total'
    (VEHICLE, DRIVER, START_DATE, START_TIME, START_TZ, END_DATE, END_TIME, END_TZ, 
     TM_DRV_MINS, TM_IDLE_MINS, TM_PTO_MINS, TRIP_TM_MINS,
     FUEL_DRV_GALS, FUEL_IDLE_GALS, FUEL_PTO_GALS, FUEL_TRIP_GALS, FUEL_START_GALS,
     MPG, DRV_MPG, START_ODOM, END_ODOM, DIFF_ODOM, AVG_MPH, MAX_MPH, MAX_RPM,
     DATE1, TM1, TZ1, ADDRESS_NUM1, ADDRESS_STREET1, ADDRESS_ST1, ADDRESS_ZIP1, ADDRESS_COUNTY1,
     DATE2, TM2, TZ2, ADDRESS_NUM2, ADDRESS_STREET2, ADDRESS_ST2, ADDRESS_ZIP2, ADDRESS_COUNTY2,
     STOP_CT, FAULT_CODE, HARD_BRAKE)
    Note that the line WHEN is commented out, because I can't make it work.

    and here is a sample of the data:
    Vehicle,Driver,Start Date,Start Time,Timezone,End Date,End Time,Timezone,Driving (hh:mm),Idle (hh:mm),PTO (hh:mm),Trip (hh:mm),Driving (gals),Idle (gals),PTO (gals),Trip (gals),Before Trip (gals), MPG,Driving MPG,Start,End,Trip Distance (miles),Average(MPH),Maximum(MPH),Maximum RPM(rpm),Date,Time,Timezone,Address,Street,City,State,Zip,County,Date,Time,Timezone,Address,Street,City,State,Zip,County,Stop Count,Fault Code,Hard Brake,
    26033, ,01/23/08,12:40 AM,MST,01/23/08,12:42 AM,MST,0,3,0,3,0,0.12,0,0.12, ,0,0,295829.22,295829.22,0,0,6.84, ,01/23/08,12:23 AM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,12:23 AM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,0,4, ,
    26033, ,01/23/08,12:43 AM,MST,01/23/08,04:03 AM,MST,126,74,0,200,0,0,0,0, ,0,0,295829.22,295914.97,85.75,25.72,67.11, ,01/23/08,12:23 AM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,03:56 AM,MST,0,COUNTY ROAD 125,SIDNEY,MT,59270,RICHLAND,8,3, ,
    26033, ,01/23/08,04:03 AM,MST,01/23/08,12:29 PM,MST,317,190,0,507,0,0,0,0, ,0,0,295914.97,296139.9,224.94,26.64,65.87, ,01/23/08,03:56 AM,MST,0,COUNTY ROAD 125,SIDNEY,MT,59270,RICHLAND,01/23/08,12:29 PM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,14,5, ,
    Total, , , ,443,267,0,710,0,0.12,0,0.12, ,0,0,295829.22,296139.91,310.69,26.38,67.11, , , , , , , , , , , , , , , , , , , ,22,12,0,
    Vehicle,Driver,Start Date,Start Time,Timezone,End Date,End Time,Timezone,Driving (hh:mm),Idle (hh:mm),PTO (hh:mm),Trip (hh:mm),Driving (gals),Idle (gals),PTO (gals),Trip (gals),Before Trip (gals), MPG,Driving MPG,Start,End,Trip Distance (miles),Average(MPH),Maximum(MPH),Maximum RPM(rpm),Date,Time,Timezone,Address,Street,City,State,Zip,County,Date,Time,Timezone,Address,Street,City,State,Zip,County,Stop Count,Fault Code,Hard Brake,
    26035, ,01/23/08,03:59 AM,MST,01/23/08,09:05 AM,MST,222,85,0,306,50.87,1.5,0,52.37, ,3.32,3.42,285056.53,285230.5,173.98,34.07,68.97, ,01/23/08,03:24 AM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,01/23/08,09:00 AM,MST,0,COUNTY ROAD 338,SAVAGE,MT,59262,RICHLAND,7,3, ,
    26035, ,01/23/08,09:06 AM,MST,01/23/08,03:37 PM,MST,273,118,0,391,68.5,1.5,0,70, ,3.24,3.31,285230.5,285457.3,226.8,34.8,69.59, ,01/23/08,09:00 AM,MST,0,COUNTY ROAD 338,SAVAGE,MT,59262,RICHLAND,01/23/08,03:37 PM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,11,3, ,
    26035, ,01/23/08,03:45 PM,MST,01/23/08,04:38 PM,MST,32,21,0,53,7.37,0.25,0,7.62, ,3.42,3.54,285457.3,285483.4,26.1,29.73,67.73, ,01/23/08,03:37 PM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,01/23/08,04:33 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,2,3, ,
    26035, ,01/23/08,04:49 PM,MST,01/23/08,10:22 PM,MST,256,76,0,332,52,1.25,0,53.25, ,3.71,3.8,285483.4,285681.0,197.6,35.67,64, ,01/23/08,04:33 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,10:17 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,9,3, ,
    26035, ,01/23/08,10:25 PM,MST,01/23/08,10:35 PM,MST,4,5,0,10,0.37,0,0,0.37, ,1.68,1.68,285681.0,285681.62,0.62,3.9,24.85, ,01/23/08,10:17 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,10:35 PM,MST,0,COUNTY ROAD 338,SAVAGE,MT,59262,RICHLAND,1,5, ,
    Total, , , ,787,305,0,1092,179.11,4.5,0,183.61, ,3.4,3.49,285056.53,285681.62,625.1,34.35,69.59, , , , , , , , , , , , , , , , , , , ,30,17,0,
    As you can see, I need to have the SQL Loader to ignore the header and summary lines that appear for each grouping. Your suggestions are welcome as I need to implement this in an automatic process, I can call with a batch script.

    blarman74 wrote:
    Can anyone suggest how to fix this problem? The log file shows this error:

    Record 8: Rejected - Error on table ROAD_DIAGS, column DATE2.
    ORA-01858: a non-numeric character was found where a numeric was expected
    

    The error message is clear - you try to load a value "non-date" in a DATE column and, therefore, sql * loader berms.
    That points to a discrepancy between the list of columns in the control file and, in the data file.
    Note the position of the table of the "DATE2" column in the table "ROAD_DIAGS":

    test@XE>
    test@XE> l
      1  select table_name,
      2         column_name,
      3         column_id
      4    from user_tab_columns
      5   where table_name='ROAD_DIAGS'
      6*    and column_name='DATE2'
    test@XE> /
    
    TABLE_NAME      COLUMN_NAME      COLUMN_ID
    --------------- --------------- ----------
    ROAD_DIAGS      DATE2                   34
    
    test@XE>
    

    If your control file specifies that the 34th column in the data file must be "DATE2". However-

    test@XE>
    test@XE> -- display the line number and the 34th column of the data file
    test@XE>
    test@XE> !perl -ne '{@a=split/,/; print $.,"\t",$a[33],"\n"}' Daily_Diagnostics_test.csv
    1       County
    2       RICHLAND
    3       RICHLAND
    4       RICHLAND
    5
    6       County
    7       RICHLAND
    8       RICHLAND
    9       RICHLAND
    10      RICHLAND
    11      RICHLAND
    12
    
    test@XE>
    

    the 34th column in your data file is 'COUNTY', which is counted in your control file.

    Here is the list of the columns for 29 to 37 positions in the csv file:

    test@XE>
    test@XE> !perl -ne '{if ($. == 1) {@a=split/,/; foreach $i (28..36) {print $i+1,"\t",$a[$i],"\n"}}}' Daily_Diagnostics_test.csv
    29      Address
    30      Street
    31      City
    32      State
    33      Zip
    34      County
    35      Date
    36      Time
    37      Timezone
    
    test@XE>
    test@XE>
    

    And here are the columns specified in the control file:

      ...
      ...
      ADDRESS_NUM1,
      ADDRESS_STREET1,
      ADDRESS_ST1,
      ADDRESS_ZIP1,
      ADDRESS_COUNTY1,
      DATE2            DATE "MM/DD/YYYY",
      TM2              DATE "HH:MI AM",
      TZ2,
      ...
      ...
    

    (You can open the csv file in MS Excel to get a better picture of the data in there).

    As seen above, due to the incompatibility, sql * loader loads 'City' in ADDRESS_ST1, 'State' in ADDRESS_ZIP1, "Zip" in ADDRESS_COUNTY1 and DATE2 "County" - where it error.

    The solution would be-

    (a) If you want to load the 'City' information from the data file, and then add the "City" column in the table (if nonexistent) and specify in the control file.

    (b) If you do not want to load the 'City' information from the data file, you can specify a column to 'FILL' in the file of control as follows:

      ...
      ...
      ADDRESS_NUM1,
      ADDRESS_STREET1,
      city1            FILLER,
      ADDRESS_ST1,
      ADDRESS_ZIP1,
      ADDRESS_COUNTY1,
      DATE2            DATE "MM/DD/YYYY",
      TM2              DATE "HH:MI AM",
      TZ2,
      ADDRESS_NUM2,
      ADDRESS_STREET2,
      city2            FILLER,
      ADDRESS_ST2,
      ADDRESS_ZIP2,
      ADDRESS_COUNTY2,
      ...
      ...
    

    Hope that helps,
    isotope

  • Need help about sql loader

    Hello

    I will execute following command

    sqlldr admin_user@ces CONTROL = D:\sample_control.ctl log = D:\sample_log.log D:\Sample_bad.bad = bad

    In the case of valid data, it's inserted data properly into the table. While no valid records added in the wrong file.

    Now I want to restore whenever valid data that the number of bad record greater than equal to 10.

    In short, whenever the file has more than 10 invalid records, I don't want to insert any record of this file.

    Please give me the solution. Thanks in advance.

    SQL * Loader command line reference

    DISCARDMAX (Integer)

    Concerning

    Etbin

  • SQL loader error

    Hi all

    I wrote a check as file

    load data

    INFILE 'D:/ReddSX/SHIP/destroyed_books.csv '.

    in the t82dstry_new table

    fields completed by «,»

    (ID, DEALER, BEGINING_AGREEMENT, ENDING_AGREEMENT, COMMENTS, DATE

    )

    He saw 1231 documents but when execute sqlldr show

    C:\ > sqlldr dlradt/Budget12@cdrtst control=D:\ReddSX\t82dstry_new.ctl

    SQL * Loader: release 11.2.0.1.0 - Production on Wednesday, may 28 03:07:22 2014

    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

    Commit the point reached - the number of logical records 52

    and he does not also 52 records in the table,

    What is the problem someone help me?

    Thank you

    David

    The control file you posted does not produce this error, since I use as DATE column name without enclosing in double quotes would not work.  You must post your real control file, a few examples of data, the structure of your table, your log file and some records of your incorrect file sample.  If you get a partial cargo, then your log file and the wrong file will most help you determine why.  If you do not have to specfy INSERT or another option, then by default to INSERT in all cases, but this requires that the table is empty.  You can use APPEND if the table is not empty.

  • Reg - Sql Loader

    Hello

    IAM using sql loader to load data into a table

    For example:

    my file has

    ID CREATED_DATE

    FEBRUARY 21, 2012 121

    FEBRUARY 22, 2012 122

    ABDELLAH 123

    MARCH 16, 2012 124

    and my table data type is

    Test_Table DESC

    CREATED_DATE DATE

    IDENTIFICATION NUMBER

    in this case, while inserting the 3 rows. It will return the exception.

    so it will not insert the 4 rows in table. My requirment is if the 3 rows

    throw the exception. I want to eliminate the 3 rows and insert the 4 rows. So my last

    This results in the table

    ID CREATED_DATE

    FEBRUARY 21, 2012 121

    FEBRUARY 22, 2012 122

    MARCH 16, 2012 124

    is it possible to handle this exception in sql loader. PLs help

    For this you must create a function to check the date format, then you can load the data based on this value. Try the below

    -Function to check the format

    FUNCTION to CREATE or REPLACE test_fun (p_indate VARCHAR2)

    RETURN NUMBER

    AS

    v_indtchk DATE;

    BEGIN

    v_indtchk: = TO_DATE(p_indate,'DD-MON-YYYY');

    RETURN 0;

    EXCEPTION

    WHILE OTHERS THEN

    RETURN 1;

    END;

    -Control file

    DOWNLOAD THE DATA

    INFILE 'F:\ANNFOL\sample2.csv '.

    TRUNCATE

    IN THE TABLE test_ldr

    FIELDS ENDED BY ',' OPTIONALLY SURROUNDED "" "

    TRAILING NULLCOLS

    (

    CREATED_DATE "DECODE (test_fun(:CREATED_DATE), 0, TO_DATE(:CREATED_DATE,'DD-MON-YYYY'), NULL);

    ID

    )

  • Reg: Problem SQL Loader-

    Hi Experts,

    I am trying to load data from a flat file in an Oracle table, but face some problems.

    Concern (1) (1)

    I have a directory where there are about 20 similar files named as 'rb_1', 'rb_2', 'rb_3', etc...

    All these data should be loaded in a Word only table 'X '.

    Is it possible that only 1 CTL file will make a loop and load all the files in X?

    Concern (2) (2)

    Field delimiter is Ctrl-X (CAN: cancel) and Ctrl-M (EM: em) characters

    Line delimiter is Ctrl-Z (SUB: substitute) and Ctrl-T (DC4: Device Control) characters

    Is there a way I can specify this in my CTL file?

    (I've only worked on delimiter of field as comma "«»", de champ comme virgule «», pas speciales personnages comme ca not special characters like that)

    Please let me know if any additional information is required.

    Help much appreciated.

    Thank you

    -Nordine


    Agree with Hoek, you'd better to use external tables you can specify multiple filenames at once, otherwise you will have a script that provides the name of the input file when calling sql loader and make this script loop for each file.

    Regarding the ctrl characters in your delimiters, control file supports the hexagonal versions of them for example

    fields terminated by ' 09 x. "

    where 9 is the hexagon of the ascii value of the character (in this case a tab character).

    CTRL-m, that would be x ' 0 of etc.

  • SQL Loader insert string

    Hello

    I have recently started using SQL loader and got a request that I need assistance to do this: -.

    Lets say there is an excel file with the data to be loaded into the table 'test '. data from looks like this

    customer_id customer_location
    + new york 1 +.
    + new jersey 2 +.
    + california 3 +.


    My Test table looks like: -.

    create table test (customer_id number, client_name varchar2 (4000), customer_location varchar2 (200));


    My requirement is now that I need to write a control file that fills the field client_name with text "test_user" for each line of data file.

    So the final data should look like this: -.

    Select * from test;


    customer_id client_name customer_location
    + 1 test_user NYC +.
    + 2 test_user new jersey +.
    + 3 test_user California +.

    I use a direct charge. Please help me make the control file. I just want to know the logic for the settlement of the columns that are not present in great file.


    Thanks in advance.

    Edited by: 974647 April 1, 2013 10:17

    SQL * Loader supports constants. Read the definition of a column to a constant value.

    SY.

  • Difference between external tables and sql * loader

    Hello

    Could you please tell me the difference between
    tables external and sql * loader

    I have serached on the net but did ' get correct idea

    Please help me

    1 SQL LOADER can be run on the network (from any client computer), external tables can't

    2. return to the Oracle 9, external Tables could not load CLOB/BLOB (Oracle10 changed it)

    3 oracle 11 external tables have preprocessor, which is pretty dam characteristic cool - running essentially any OS command e.g. decompress before external table run. What's even better is the fact that the result of the operating system command is the source of the outer table, which means that there are no required temporary file (unzip the tracks and the output is the source of the external table). There are several ways to great use this - look at my blog for samples rare http://jiri.wordpress.com/2010/01/19/no-more-unix-scripts-in-11-2/

    4. as long as the 009 stressed, filed external load anything, they show just. Think of it more as load on request - it's great if you have old files archived and one or two users what to see content once a while

    5. external tables require no user access to the operating system, it is oracle environment pure - this may seem minor but for me it's huge. The fact that the ETL needs no special unix, no control file command and uses the simple SQL and DDL is nice and important

    6. external tables can load more text files, Oracle export dump files can be loaded, perhaps in the future more formats will be supported (hopefully all right excel format?)

    now the same thing to kill the myth - the TWO are EXACTLY the same when it comes to speed, I would actually drive of the external tables before will be faster because sql loader is old technology oracle doesn't really develops more

  • SQL loader loading data from legacy to Oracle

    Hello

    We have a requirement that we have to import legacy data to oracle AR. We know we have to put the data file in the BIN folder, but I want to know the source of data file if we put in the windows folder instead of the directory BIN will be SQL loader retrieves the file and loads the data.

    Thank you
    THERE

    Yes,

    Refer to this

    http://www.Oracle.com/technology/products/database/utilities/htdocs/sql_loader_overview.html

    * Load data across a network. This means that SQL * Loader client can be run on a different system that is running the SQL * Loader server.
    * Load the data from several data during the same load session files
    * Load data into multiple tables in the same load session
    * Specify the character set of the data
    * Selectively load data
    * Load the data from the disk, tape, or named pipe
    * Specify the character set of the data
    Generate reports of sophisticated, error that greatly helps troubleshooting
    Load arbitrarily complex object-relational data
    * Use either conventional path loading or direct.

    Arun-

  • Cannot load a required step of associates module Err :-17600

    the deployment of that image works fine in the dev system.

    but the deployment system "failed to load a required step of associates module Err :-17600" this error.

    I suspect it has to do with search folders.

    where I can change into a deployment machine the research file settings.

    Well, I tried a sample project (simple), but it worked on the maschine deployment.

    2. I use the classes & objects in my seq file. (I tried to take all precautions to play safe)

    There was a windows DLL missing in my deplyoment maschine 'msvcr100d.dll '.

    OR support helped me thr that I didn't have labview on my machine of deployment.

    & Dev maschine, everything was OK

Maybe you are looking for