Help with SQL Loader when Clause

I have 2 exact same structure Oracle tables.


NUMBER OF ENO
NUMBER OF PARENT
NUMBER OF CHILDREN
ENAME VARCHAR2 (50 bytes)
ADDRESS VARCHAR2 (50 bytes)
CITY VARCHAR2 (50 bytes)
SRCFILENAME VARCHAR2 (50 bytes)
SDATE VARCHAR2 (400 bytes)
Current_Load VARCHAR2 (1 byte)




Have a data file and a charger control file that loads data into these 2 tables.
I need to make a conditional charge using a when clause.
Condition: what MOTHER = CHILD, load table 2 other load in table 1

My control file looks like this.
LOAD DATA 
INFILE 'TEST_20120815.txt' 
APPEND INTO TABLE test1 
fields terminated by "|" 
trailing nullcols 
( 
eno, 
parent, 
child, 
ename, 
address, 
city , 
sdate "to_date(:sdate,'DD/MM/YYYY')", 
SrcFileName, 
col7 filler, 
"Current_Load" constant 'Y' 
) 
INTO TABLE test2 when (parent=child) 
fields terminated by "|" 
trailing nullcols 
( 
eno position(1), 
parent, 
child, 
ename, 
address, 
city , 
sdate "to_date(:sdate,'DD/MM/YYYY')", 
SrcFileName, 
col7 filler, 
"Current_Load" constant 'Y' 
) 
But it does not work. It works fine if I give a direct value like PARENT = 'P '.

Any idea how compare the 2 fields while the conditional support?

You can't compare 2 fields with the WHEN clause in SQL * file the charger control.
only literal values as defined by the syntax:

http://docs.Oracle.com/CD/B19306_01/server.102/b14215/ldr_control_file.htm#i1005657

As already suggested, you'd be better to load data using an external table which allows to apply conditions you want in your SQL query, which is to get the data.

Tags: Database

Similar Questions

  • 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

  • SQL Loader when Clause

    Hello

    I have a requirement to load a file and exclude lines on a column with a value where ID NOT LIKE ' % no data %'

    OPTIONS (SKIP = 3)

    DOWNLOAD THE DATA

    INFILE ' / home/test.csv '

    IN THE test TABLE

    TRUNCATE

    What ID do NOT LIKE ' % no data %'

    ' Surrounded FIELDS TERMINATED BY ',' possibly ' ' '

    TRAILING NULLCOLS

    (ID,

    BEGUN,

    TIME,

    DATE_ADDED SYSDATE

    )

    Some examples of ID:

    Data AVDFGHKL:no

    Data THGEIUJD:no

    The value will always point 10 a go (after the semi colon)

    I tried the following, but not luck

    When (1) = '1') AND (10:2). = 'No '.

    Yes, the outer table can be a better option (the file must be in the server). Depending on your data (i.e. the colon (:)) always comes in 9th place) it will work.)

    [oracle@localhost saubhik]$ cat my_data.txt
    AVDFGHKL:No Data, 09/11/2009
    JFDJFUJK, 09/11/2009
    AGHFJDKK:No Data, 09/11/2009
    TRUTIRUT, 09/11/2009
    [oracle@localhost saubhik]$ 
    
    [oracle@localhost saubhik]$ cat test_emp_ctl.ctl
    LOAD DATA
    INFILE 'my_data.txt'
    INTO TABLE test
    TRUNCATE
    when (9:9) <> ":"
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    (id, start_date DATE(19) "DD-MM-YYYY")
    [oracle@localhost saubhik]$ sqlldr scott/tiger control=test_emp_ctl.ctl
    
    SQL*Loader: Release 11.2.0.1.0 - Production on Tue Jun 2 16:20:22 2015
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    Commit point reached - logical record count 4
    [oracle@localhost saubhik]$ 
    

    Audit:

    SQL> SELECT * FROM test;
    
    ID                             START_DAT
    ------------------------------ ---------
    JFDJFUJK                       09-NOV-09
    TRUTIRUT                       09-NOV-09
    
    SQL> 
    
  • Need help with Sql Tunning

    Under Update taking 2 h complete 3000 sets.

    UPDATE ARR_TRANSACTIONS ARR

    SET = NUMBER99

    (SELECT ARR_1.NUMBER99

    OF ARR_TRANSACTIONS ARR_1, ARR_HEADER BH

    WHERE ARR_1.ARR_ID = BH. ARR_ID

    AND BH. FLAG = "Y".

    AND ARR_1.LINE_ID = ARR. ORIG_INV_LINE_ID

    AND ARR_1.NUMBER9 IS NOT NULL

    AND ROWNUM = 1)

    WHERE ARR BATCH_ID = 26219

    AND ARR. NUMBER99 IS NULL

    I added more some condition where to reduce cost and its working fine. But I need to rise more than performance on SQL.

    Please help with SQL.

    I do not see the number of 3000 lines in the plan - so I guess that the optimizer does not compute with the correct numbers. Could generate the plan with dbms_xplan.display_cursor? This could tell us something about filter predicates and access.

    In the given situation, I would check:

    • is the access to the index in step 1 (filtered by the relevant conditions: this could be BATCH_ID = 26219) return actually 248 entries (or something similar)?
    • Access table in step 2 returning 204 lines (or something similar) after applying the filters given? If the number of lines is much bigger then a Nested Loops is perhaps not a good idea.

    To make this much simpler check, you could create a plan with statistics of content (RowSource) given that the plan containing the real and the number of estimated rows.

    If the estimated cardinalities are not plausible the next question would be if the statistics are strong and up to date.

  • Where clause ' where 1 = 1 ' help with SQL tuning

    Hello Tuning specialists,.
    It is useful to use ' where 1 = 1 ' and then type all joins and conditions in the statements 'AND' of the SQL when writing SQL queries. I would like to know if it helps with the writing queirs this way SQL query performance.

    Thanks in advance.

    Published by: oracle_developer on October 8, 2012 10:41

    oracle_developer wrote:
    Hello Tuning specialists,.
    It is useful to use ' where 1 = 1 ' and then type all joins and joins in the statements "AND" when writing SQL queries.
    I would like to know if it helps with the writing queirs this way SQL query performance.

    He has No. performance impact.
    It is done when building dynamic SQL, so each sentence can start with AND

  • SQL loader when error clause

    Hello

    I have this CTL file as below:

    DOWNLOAD THE DATA
    INFILE 'PRODUCT_*.csv '.
    ADD
    IN THE PRODUCT_CONFIG TABLE
    "WHEN <>(1:3) and (1:3) <>' 99" and <>' 00, «,» (1:4),
    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
    TRAILING NULLCOLS
    (
    PARTNUMBER NULLIF PARTNUMBER = BLANKS,
    NULLIF LABEL = BLANKS,
    NULLIF SEQUENCE SEQUENCE = BLANKS,
    NULLIF DISPLAY_FLAG DISPLAY_FLAG = BLANKS,
    BILL_PERIOD NULLIF BILL_PERIOD = BLANKS)

    However, I got this error when I run my file:

    SQL * Loader-350: error of syntax in line 6.
    Expecting "(", found "99".
    "WHEN <>(1:3) and (1:3) <>' 99" and <>' 00, «,» (1:4),


    How can I change my code to solve this error?

    Hello

    After your data, I created a test table and load the data successfully. See if this example helps you

    CREATE TABLE test (
       col1 VARCHAR2 (20),
       col2 VARCHAR2 (30),
       col3 NUMBER,
       col4 NUMBER
    );
    
    load data
    truncate into table test
    when ( col1 !='00') and (col1 !='99')
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (col1 char(20),
    col2 char(30),
    col3 integer external,
    col4 integer external
    );
    
    {code}
    
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    
  • Encapsulate data problems when loading with sql loader

    Hi all

    I use sql loader to load data into a flat file HP UNIX.

    I find the fi the NUMBER data type or date type get wraped to the new line, the control file triggered errors.

    The data looks like to (field dilimiter is |, record dilimter is ~):

    1 A87CCH | 1 A87CCH | PLAN_ACCOUNT_PROMOTION | HIR6A-1 | 20100706 06:06:24 | 1 DNE1 | DC?
    2010.7 FY1011 Promoiton | 1 A87AW0 | 1 HJEZE | Private | 20100730 00:00:00 | 00 20100710
    : 00:00 | 0 | Completed | 20100730 00:00:00 | 20100710 00:00:00 | 0 | 1 4A6PKP | TFMAAI | N
    | 0 | 0 | 0 | 0 | 0 | 0 | 1 4A6PKP | Approved | 1 8U4E-163 | 00:00:20110630 00 |
    20100708 01:45:35 | 20100707 00:00:00 | -1||| 0 | 9000 | 0 | 0 ||| 100. N | 0 | 0 | 0 | 0
    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | N | 20110426 04:01:34 | 1 8U4E-163 | 0|||||||||
    ||||| ~


    The control file looks like:

    OPTIONS (ERRORS = 1000, DIRECT = TRUE, PARALLEL = TRUE, DATE_CACHE = 5000, discardmax = 50)
    UNRECOVERABLE
    load data
    INFILE ' / home/bs7822/leon/leon.dat' "str" ~ "»
    BADFILE ' / home/bs7822/leon/leon.bad'
    DISCARDFILE ' / home/bs7822/leon/leon.discard'
    ADD THE LEON_123456 TABLE
    FIELDS TERMINATED BY ' | '. SURROUNDED OF POSSIBLY "" "
    TRAILING NULLCOLS
    (
    X_INTERFACED_DT EXPRESSION "to_date (replace (replace (: X_INTERFACED_DT_BF, chr (10),"), Chr (13), "), 'YYYYMMDD hh24:mi:ss')", "
    X_INTERFACED_DT_BF boundfiller,
    EXTERNAL DECIMAL X_ACCRUAL_AMT,
    X_PLAN_SHIPMENT_PATTERN_ID TANK (90)
    )

    I think that replace it can treat the wrapped date. But I want to know if we can find a faster or easier way to conquer this topic since the beginning.

    Best regards

    Leon

    user12064076 wrote:
    Thank you for your response. But how to ensure that a record is in a single line? For example, to unload data with coil?

    The table has more than 100 columns.

    Best regards
    Leon

    UH... which guarantee is implemented by anyone or anything that generates the data in the first place.
    for example if I am extracting data to CSV for a customer or another application, making sure that it is 1 card per line with delimiters known etc.

    What is your own code that produces the data in the first place? If so, how are you to produce? With large amounts of data I wouldn't do it with SQL * Plus spool command, but I do with UTL_FILE within PL/SQL, or generating data in a file CLOB and spell the CLOB in a go using one of the CLOB methods available writing files.

  • Problem with Sql Loader

    Hi s/n,.

    I am facing problems when loading the dates in the database by using sql loader. My data file can have several date formats, so I have a function that interprets date and removes the time settings and the date of return.

    Something like that.

    For example:

    I have a table-

    CREATE TABLE TEMP1234

    (

    IDENTIFICATION NUMBER,

    DATE OF ASOF_DATE

    );

    Data file

    10001172 | 09/12/1945

    Control file:

    OPTIONS (DIRECT = TRUE, SILENT (FEEDBACK) =, skip = 0)

    DATA RELATING TO SUNK COSTS

    REPLACE

    in the temp1234 table

    ' fields completed by "|" possibly provided by ' "'

    TRAILING NULLCOLS

    (ID,

    ASOF_DATE "decode (: ASOF_DATE, null,:ASOF_DATE,conv_date1(:ASOF_DATE))).

    )

    Function CONV_DATE1:

    FUNCTION to CREATE or REPLACE conv_date1 (p_str IN VARCHAR2)
    DATE OF RETURN
    IS
    RETURN_VALUE DATE;

    p_str1 VARCHAR2 (15): = NULL;

    FmtArray TYPE IS a TABLE OF VARCHAR2 (30);

    g_fmts fmtArray
    : = fmtArray ("yyyy-mm-dd",
    "yyyy/mm/dd"
    mm/dd/yyyy"."
    "dd-mm-yyyy",
    "dd/mm/yyyy",
    "mm-dd-yyyy");
    BEGIN
    p_str1: = SUBSTR (p_str, 1, 10);

    BECAUSE me in 1... g_fmts. COUNTY
    LOOP
    BEGIN
    return_value: = TO_DATE (p_str1, g_fmts (i));
    EXIT;
    EXCEPTION
    WHILE OTHERS
    THEN
    NULL;
    END;
    END LOOP;

    IF (return_value IS NULL)
    THEN
    RAISE PROGRAM_ERROR;
    END IF;

    RETURN Return_value;
    END;
    /

    In this case, if the year in the data file shown in 1945, date which is load in the poster 2045 database.

    But when I run this function by putting a sql editor - it returns the correct value.

    Select double conv_date1('12/09/1945');

    Please help me understand what is causing the problem.

    I think there may be an implicit conversion going on with the combination of decode and checking nvl and function within SQL * Loader.  I put the nvl checking in function and simply use the function in the control file, as shown below.

    OPTIONS (DIRECT = TRUE, SILENT (FEEDBACK) =, skip = 0)

    DATA RELATING TO SUNK COSTS

    REPLACE

    in the temp1234 table

    ' fields completed by "|" possibly provided by ' "'

    TRAILING NULLCOLS

    (ID,

    asof_date ' conv_date1 (: asof_date).

    )

    FUNCTION to CREATE or REPLACE conv_date1 (p_str IN VARCHAR2)

    DATE OF RETURN

    IS

    RETURN_VALUE DATE;

    p_str1 VARCHAR2 (15): = NULL;

    FmtArray TYPE IS a TABLE OF VARCHAR2 (30);

    g_fmts fmtArray

    : = fmtArray ("yyyy-mm-dd",

    "yyyy/mm/dd"

    mm/dd/yyyy"."

    "dd-mm-yyyy",

    "dd/mm/yyyy",

    "mm-dd-yyyy");

    BEGIN

    IF p_str IS NULL

    THEN RETURN NULL;

    ON THE OTHER

    p_str1: = SUBSTR (p_str, 1, 10);

    BECAUSE me in 1... g_fmts. COUNTY

    LOOP

    BEGIN

    return_value: = TO_DATE (p_str1, g_fmts (i));

    EXIT;

    EXCEPTION

    WHILE OTHERS

    THEN

    NULL;

    END;

    END LOOP;

    IF (return_value IS NULL)

    THEN

    RAISE PROGRAM_ERROR;

    END IF;

    RETURN Return_value;

    END IF;

    END;

    /

  • SQL Loader / WHAT clause / off swich? / bloated log files

    Hello everyone,

    I'm loading data using SQL-Loader very large source files. It all works very well.

    However, now, by using the WHEN clause (in the control file), I would like to only a very small subset of most load data. This also works very well...

    WHEN ARTICLECODE! '000000000000006769' =

    However, the log file becomes fully inflated with messages telling me to each record that does not have the WHEN clause...

    Record 55078: Discarded - failed all WHEN clauses.

    This becomes a problem because it slows down the process and creates large log files that eat upward of my disk space.

    There must be a simple command to allow me to disable the messages of thiese, but although I googled on it, I could not find it.

    Any ideas on this one? I don't know that it's simple.

    Best regards and many thanks,
    Alan Searle

    Try adding the SILENCE = RELEASES key sqlldr command

    Silent means - delete messages during execution (header, comments, errors, discards, partitions)

  • Help with SQL Query (Subselects)

    Hello community,

    IAM a new Member in this forum. The first excuse my English, my native language is German.
    In my workplace, we have a great Orcle Database 11 g with 30 different tables for production control issues.
    I try to get a couple of different information from the database, so I started with SQL of the query, but for this problem, I wasn't able to write a query to work.

    In this case, I have 2 tables:
    Table 1:
    ID; ORDER_NR; DESCRIPTION; CREATE_DATE
    1; A500236; CLEAN HOUSE; 20/02/2012
    2; A623555; REPAIR CAR; 10/01/2012
    3; A866944; MAINTAIN EQUIPMENT; 11/02/2012

    Table 2:
    ID; ORDER_NR; WO_STEP; STEP_DATE; EMPLOYEE
    1; A500236; A; 21/02/2012; W0010
    2; A500239; F; 21/02/2012; W0010
    3; A500239; S; 22/02/2012; W0027
    4; A500239; R; 23/02/2012; H0034
    5; A500239; U; 25/02/2012; L0099
    6; A263555; A; 15/01/2012; G0009
    7; A263555; C; 17/01/2012; S0039
    5 V A263555; R; 18/01/2012; K0059
    9; A263555; U; 19/01/2012; A0048
    10; A866944; A; 13/02/2012; H0034
    11; A866944; B; 13/02/2012; L0035
    12; A866944; G; 17/02/2012; D0084
    13; A866944; U; 23/02/2012; S0039

    And the result of my query should look like this:
    ORDER_NR; DESCRIPTION; CREATE_DATE; A_STAT_AGE; R_STAT_AGE; U_STAT_AGE
    A500236; OWN HOME; 20/02/2012; 5; 3; 1
    A623555; REPAIR CAR; 01/10/2012; 42; 39; 38
    A866944; MAINTAIN EQUIPMENT; 11/02/2012; 15; 4; 3

    The age of my query result should be calculated from the date of the creation of the order.
    I would like to know 2 things, one is how old was the order when they reached this status, R and U.
    The second, that is, how long did you order remaining on A stat, R and U (and if possible all the others too)
    It can happen that not every order reaches every State, so he ca go directly from A you in this case I want to display a generic character in this row/column

    I hope you all know what I mean and what result to expect.

    Thanks for your help.

    Reinhard W.

    Hi, Reinhard,

    990524 wrote:
    Hi Frank,.

    I thank you for your professional response and excuse my non-professional way to clarify my question.
    I have now already read and understand how to ask good questions, but is there an easy an inexpensive way to run a database on my computer at home?

    You can download the Oracle database from this site. The Express edition is easier to install. It lacks a few features that the Enterprise edition (for example, partitioning table and safety of level line), but most of the things work in all editions of Oracle.
    All editions are free if you do not use them for Production applications. Of course, at this price (or lack thereof), you get Oracle support.

    I have already noticed that the syntax SQL for Oracle differ from other DBMSS.

    Yes and some features are different in different products.

    Your query works perfectly, thank you.

    Now I want to refine my (your) query, is there a way to display a range of day within 1 day? As 0.5 day to half a day between two State timestamp.

    Of course, you can do it. After the exact output desired of the sample data that I posted. If the sample data do not show what you need to do, then after a few different examples of data that makes.

    My table contains the Date and time in a row, I forgot to mention that.

    After a CREATE TABLE statement. I was guessing a lot of things that may be important. For example, I assumed you were using a DATE for date and time column. So it is only reasonable to do so, but maybe it's not what looks like at your table.

    I tried something like this:

    SYSDATE - MIN ( CASE
                        WHEN  t2.wo_step = 'A'
                  THEN  t2.step_date
              END
               ) AS Age_A
    

    But it gives me an error of arithmetic overflow and not die difference in the Date and time or days with decimal friction.

    There are only about 5.4 million possible days with DATEs of Oracle. Is only 7 digits and Oracle can treat approximately 39 numbers without overflow errors, so I don't see how this can happen if t2.step_date is really a DATE. This is an example of why you need to publish a CREATE TABLE statement.

  • Need help with SQL/PL/SQL for Dates

    Hi Experts - need help with a SQL query.

    I need to insert some date fields in a table called CALENDAR_PERIOD.

    Current data in CALENDAR_PERIOD table with their data types:

    STARTPERIOD (DATE) YEAR (NUMBER) PERIOD_LABEL (Varchar2 255)

    02/11/2014 2014 2014/02/11 SUN

    03/11/2014 2014 14/03/11 MON

    04/11/2014 2014 11/04/14 MAR

    I have to increment above values up to the year 2025. I don't know how to write SQL and increment of these values.

    Ex: My next value should insert: 05/11/2015 2014 11/05/14 WED like that I need to insert data until 12 31, 2025.

    Can you please help me with PL/SQL block?

    Really appreciate your help!

    DB version:

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

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    Thank you
    Sandy

    Hello Sandy,

    Maybe something like

    INSERT INTO calendar_period (startperiod, year, period_label)

    SELECT DATE '' 2014-11-04 + LEVEL

    , TO_NUMBER (TO_CHAR (DATE '' 2014-11-04 + LEVEL, "YYYY"))

    , TO_CHAR (DATE '' 2014-11-04 + LEVEL, "MM/DD/YY DY")

    OF the double

    CONNECT BY LEVEL<= date="" '2025-12-314="" -="" date="">

    ;

    ((mais je ne comprends pas pourquoi nous créons une telle table "année" et "period_label" peuvent être calculé à partir de startperiod))

    Best regards

    Bruno Vroman.

  • variable with sql reuse various clauses

    Hello

    Is it possible to reuse the same variable with sql different queries in the packages...

    Example:

    I have a Word to say variable

    name of the variable 1): filename

    (2) in variable query: select 'emp.txt' of the double

    so using the name of this variable in the data store, I'm passing filename dynamically, but I need to change the file name to dept.txt emp.txt missing emp.txt food.

    A solution on my side uses a table dump with the file name. more without the use of db tables

    Please share views

    See you soon,.
    Surya

    You will then need the help of beanshell java technology. Variable2 take the second query in cooling mode. Now, create a procedure. At the 1st step of technology will be java beanshell with below codes.

    <>
    String xtr = "#variable2";
    @>

    Now in ko-> step use variable1 in assign mode

    Variable1 =<@=xtr@>

    It will certainly work.

    Thank you.

  • Problem with SQL Loader ODI

    Hello

    I have problems using SQL Loader with ODI. I am filling an oracle table with data from a txt file. Initially, I had used 'File to SQL' LKM, but due to the size of the file (700 MB) source, I decided to use 'file to Oracle (SQLLDR)' LKM.
    The error that appears in myFile.txt.log is: "SQL * Loader-101: invalid argument for the name of user and password.

    I think the problem might be in the definition of the database server (physical JavaBeans in topology), because I left empty Host, user and password.

    What is the problem? What host and user should I use? With "File to SQL" works fine living that white, but takes too much time.

    Thanks in advance

    Note the last * @*. He expects a connection string after him.

    So, goto Oracle server topology, specify Instance/Dblink (server) as the SID of the oracle database you want to connect.

  • Loading data with sql loader

    Hi Experts,

    I have a file in the following format. I have to insert the data from these files in a table. Can I use SQL Loader to load these files.

    My question is that I need to schedule the download of these files. Can I integrate sql loader in a procedure?
    Agent Id|Agent Type|Create Date|Termination CDC|Activation CDC|Deactivation CDC|Agent IdX|Agent Status|Status Date|Status Reason Code|Update CDC|Update Serial|Update User|New Owner Agent Id|Previous Owner Agent Id|Agent Name|Primary Address1|Primary Address2|Primary Address3|Secondary Address1|Secondary Address2|Secondary Address3| Primary City|Primary State|Primary Zip|Primary Zip Suffix|Primary Country|Secondary City|Secondary State|Secondary Zip|Secondary Zip Suffix|Secondary Country|Phone Number|Fax number|Mobile Number|Business Type|Field Rep|Bill to Chain Id|Mon Open Time|Mon Close Time|Tue Open Time|Tue Close Time|Wed Open Time|Wed Close Time|Thu Open Time|Thu Close Time|Fri Open Time|Fri Close Time|Sat Open Time|Sat Close Time|Sun Open Time|Sun Close Time|Zone Id|Line Charge Class|Chain Id|Chain Code| Primary Contact  Name| Primary Contact Title| Primary Contact Phone|Secondary Contact Name|Secondary Contact Title|Secondary Contact Phone|Tertiary contact Name|Tertiary Contact Title|Tertiary Contact Phone| Bank Id| Bank Account Id| bank Account Type| Bank Account Date| EFT Flag| Fund Limit|Invoicable|TaxCode|Tax Id|Sales Tax|Service Charge|Instant Cashing Type|Instant Telsel Rep| Instant Number of Bins| Instant Number Itvms| InstantCredit Limit|Auto Reorder| Instant Terminal Reorder| Instant Telsel Reorder| Instant Teleset Active CDC| Instant Initial Distribution|Auto Telsel Schedule| Instant Auto Settle| Instant Call Day| Instant Call Week| Instant Call Cycle| Instant Order Restriction| Instant Delivery Flag| Instant Account Type| Instant Settle Class| Region|County|Territory|Route|Chain Statement|Master Agent Id| Minority Owned| Tax Name| State Tax Id|Mailing Name| Bank Account Name| DSR
    0|1|0|0|0|0|0|1|0|0|302|0|0|0|0|||||||||||||||||||||0|0|0|||||||||||||||0|0|0|||||||||||||0|-2145916800|0|0|0|0||0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0||0|0|0|||||
    1|1|1256213087|0|-39081|-39081|1|2|1256213087|999|302|0|0|0|0|Pseudo Outlet||||||||MU|||MU||MU|||MU||||0|0|1|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|0|0|0|||||||||||||
    {code)
    
    Edited by: Kevin CK on 02-Feb-2010 03:28                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Here you go...

    drop table agent_dump_csv_temp
    /
    
    create table agent_dump_csv_temp
      (Agent_Id                   NUMBER
      ,Agent_Type                 NUMBER
      ,Create_Date                NUMBER
      ,Termination_CDC            NUMBER
      ,Activation_CDC             NUMBER
      ,Deactivation_CDC           NUMBER
      ,Agent_IdX                  NUMBER
      ,Agent_Status               NUMBER
      ,Status_Date                NUMBER
      ,Status_Reason_Code         NUMBER
      ,Update_CDC                 NUMBER
      ,Update_Serial              NUMBER
      ,Update_User                NUMBER
      ,New_Owner_Agent_Id         NUMBER
      ,Previous_Owner_Agent_Id    NUMBER
      ,Agent_Name                 VARCHAR2(50)
      ,Primary_Address1           VARCHAR2(50)
      ,Primary_Address2           VARCHAR2(50)
      ,Primary_Address3           VARCHAR2(50)
      ,Secondary_Address1         VARCHAR2(50)
      ,Secondary_Address2         VARCHAR2(50)
      ,Secondary_Address3         VARCHAR2(50)
      ,Primary_City               VARCHAR2(50)
      ,Primary_State              VARCHAR2(50)
      ,Primary_Zip                VARCHAR2(50)
      ,Primary_Zip_Suffix         VARCHAR2(50)
      ,Primary_Country            VARCHAR2(50)
      ,Secondary_City             VARCHAR2(50)
      ,Secondary_State            VARCHAR2(50)
      ,Secondary_Zip              VARCHAR2(50)
      ,Secondary_Zip_Suffix       VARCHAR2(50)
      ,Secondary_Country          VARCHAR2(50)
      ,Phone_Number               VARCHAR2(50)
      ,Fax_number                 VARCHAR2(50)
      ,Mobile_Number              VARCHAR2(50)
      ,Business_Type              NUMBER
      ,Field_Rep                  NUMBER
      ,Bill_to_Chain_Id           NUMBER
      ,Mon_Open_Time              VARCHAR2(5)
      ,Mon_Close_Time             VARCHAR2(5)
      ,Tue_Open_Time              VARCHAR2(5)
      ,Tue_Close_Time             VARCHAR2(5)
      ,Wed_Open_Time              VARCHAR2(5)
      ,Wed_Close_Time             VARCHAR2(5)
      ,Thu_Open_Time              VARCHAR2(5)
      ,Thu_Close_Time             VARCHAR2(5)
      ,Fri_Open_Time              VARCHAR2(5)
      ,Fri_Close_Time             VARCHAR2(5)
      ,Sat_Open_Time              VARCHAR2(5)
      ,Sat_Close_Time             VARCHAR2(5)
      ,Sun_Open_Time              VARCHAR2(5)
      ,Sun_Close_Time             VARCHAR2(5)
      ,Zone_Id                    NUMBER
      ,Line_Charge_Class          NUMBER
      ,Chain_Id                   NUMBER
      ,Chain_Code                 NUMBER
      ,Primary_Contact_Name       VARCHAR2(50)
      ,Primary_Contact_Title      VARCHAR2(50)
      ,Primary_Contact_Phone      VARCHAR2(50)
      ,Secondary_Contact_Name     VARCHAR2(50)
      ,Secondary_Contact_Title    VARCHAR2(50)
      ,Secondary_Contact_Phone    VARCHAR2(50)
      ,Tertiary_contact_Name      VARCHAR2(50)
      ,Tertiary_Contact_Title     VARCHAR2(50)
      ,Tertiary_Contact_Phone     VARCHAR2(50)
      ,Bank_Id                    NUMBER
      ,Bank_Account_Id            NUMBER
      ,Bank_Account_Type          NUMBER
      ,Bank_Account_Date          NUMBER
      ,EFT_Flag                   NUMBER
      ,Fund_Limit                 NUMBER
      ,Invoicable                 NUMBER
      ,TaxCode                    NUMBER
      ,Tax_Id                     NUMBER
      ,Sales_Tax                  NUMBER
      ,Service_Charge             NUMBER
      ,Instant_Cashing_Type       NUMBER
      ,Instant_Telsel_Rep         NUMBER
      ,Instant_Number_of_Bins     NUMBER
      ,Instant_Number_Itvms       NUMBER
      ,InstantCredit_Limit        NUMBER
      ,Auto_Reorder               NUMBER
      ,Instant_Terminal_Reorder   NUMBER
      ,Instant_Telsel_Reorder     NUMBER
      ,Instant_Teleset_Active_CDC NUMBER
      ,Instant_Initial_Distribution NUMBER
      ,Auto_Telsel_Schedule       NUMBER
      ,Instant_Auto_Settle        NUMBER
      ,Instant_Call_Day           NUMBER
      ,Instant_Call_Week          NUMBER
      ,Instant_Call_Cycle         NUMBER
      ,Instant_Order_Restriction  NUMBER
      ,Instant_Delivery_Flag      NUMBER
      ,Instant_Account_Type       NUMBER
      ,Instant_Settle_Class       NUMBER
      ,Region                     NUMBER
      ,County                     NUMBER
      ,Territory_x                NUMBER
      ,Route                      NUMBER
      ,Chain_Statement            NUMBER
      ,Master_Agent_Id            NUMBER
      ,Minority_Owned             NUMBER
      ,Tax_Name                   VARCHAR2(50)
      ,State_Tax_Id               NUMBER
      ,Mailing_Name               VARCHAR2(50)
      ,Bank_Account_Name          VARCHAR2(50)
      ,DSR                        NUMBER
      )
      ORGANIZATION EXTERNAL (
       TYPE oracle_loader
        DEFAULT DIRECTORY TEST_DIR
        ACCESS PARAMETERS (
          RECORDS DELIMITED BY NEWLINE
          SKIP 1
          BADFILE 'test.bad'
          DISCARDFILE 'test.dis'
          LOGFILE 'test.log'
          FIELDS TERMINATED BY '|'
          MISSING FIELD VALUES ARE NULL
          REJECT ROWS WITH ALL NULL FIELDS
            (Agent_Id
            ,Agent_Type
            ,Create_Date
            ,Termination_CDC
            ,Activation_CDC
            ,Deactivation_CDC
            ,Agent_IdX
            ,Agent_Status
            ,Status_Date
            ,Status_Reason_Code
            ,Update_CDC
            ,Update_Serial
            ,Update_User
            ,New_Owner_Agent_Id
            ,Previous_Owner_Agent_Id
            ,Agent_Name
            ,Primary_Address1
            ,Primary_Address2
            ,Primary_Address3
            ,Secondary_Address1
            ,Secondary_Address2
            ,Secondary_Address3
            ,Primary_City
            ,Primary_State
            ,Primary_Zip
            ,Primary_Zip_Suffix
            ,Primary_Country
            ,Secondary_City
            ,Secondary_State
            ,Secondary_Zip
            ,Secondary_Zip_Suffix
            ,Secondary_Country
            ,Phone_Number
            ,Fax_number
            ,Mobile_Number
            ,Business_Type
            ,Field_Rep
            ,Bill_to_Chain_Id
            ,Mon_Open_Time
            ,Mon_Close_Time
            ,Tue_Open_Time
            ,Tue_Close_Time
            ,Wed_Open_Time
            ,Wed_Close_Time
            ,Thu_Open_Time
            ,Thu_Close_Time
            ,Fri_Open_Time
            ,Fri_Close_Time
            ,Sat_Open_Time
            ,Sat_Close_Time
            ,Sun_Open_Time
            ,Sun_Close_Time
            ,Zone_Id
            ,Line_Charge_Class
            ,Chain_Id
            ,Chain_Code
            ,Primary_Contact_Name
            ,Primary_Contact_Title
            ,Primary_Contact_Phone
            ,Secondary_Contact_Name
            ,Secondary_Contact_Title
            ,Secondary_Contact_Phone
            ,Tertiary_contact_Name
            ,Tertiary_Contact_Title
            ,Tertiary_Contact_Phone
            ,Bank_Id
            ,Bank_Account_Id
            ,Bank_Account_Type
            ,Bank_Account_Date
            ,EFT_Flag
            ,Fund_Limit
            ,Invoicable
            ,TaxCode
            ,Tax_Id
            ,Sales_Tax
            ,Service_Charge
            ,Instant_Cashing_Type
            ,Instant_Telsel_Rep
            ,Instant_Number_of_Bins
            ,Instant_Number_Itvms
            ,InstantCredit_Limit
            ,Auto_Reorder
            ,Instant_Terminal_Reorder
            ,Instant_Telsel_Reorder
            ,Instant_Teleset_Active_CDC
            ,Instant_Initial_Distribution
            ,Auto_Telsel_Schedule
            ,Instant_Auto_Settle
            ,Instant_Call_Day
            ,Instant_Call_Week
            ,Instant_Call_Cycle
            ,Instant_Order_Restriction
            ,Instant_Delivery_Flag
            ,Instant_Account_Type
            ,Instant_Settle_Class
            ,Region
            ,County
            ,Territory_x
            ,Route
            ,Chain_Statement
            ,Master_Agent_Id
            ,Minority_Owned
            ,Tax_Name
            ,State_Tax_Id
            ,Mailing_Name
            ,Bank_Account_Name
            ,DSR
          )
        )
        LOCATION ('test.txt')
      )
      PARALLEL
     REJECT LIMIT UNLIMITED
    /
    
    SQL> select * from agent_dump_csv_temp
      2  /
    
      AGENT_ID AGENT_TYPE CREATE_DATE TERMINATION_CDC ACTIVATION_CDC DEACTIVATION_CDC  AGENT_IDX AGENT_STATUS STATUS_DATE STATUS_REASON_CODE UPDATE_CDC UPDATE_SERIAL UPDATE_USER NEW_OWNER_AGENT_ID PREVIOUS_OWNER_AGENT_ID
    ---------- ---------- ----------- --------------- -------------- ---------------- ---------- ------------ ----------- ------------------ ---------- ------------- ----------- ------------------ -----------------------
    AGENT_NAME                                         PRIMARY_ADDRESS1                                   PRIMARY_ADDRESS2                                   PRIMARY_ADDRESS3
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_ADDRESS1                                 SECONDARY_ADDRESS2                                 SECONDARY_ADDRESS3                                 PRIMARY_CITY
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    PRIMARY_STATE                                      PRIMARY_ZIP                                        PRIMARY_ZIP_SUFFIX                                 PRIMARY_COUNTRY
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_CITY                                     SECONDARY_STATE                                    SECONDARY_ZIP                                      SECONDARY_ZIP_SUFFIX
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_COUNTRY                                  PHONE_NUMBER                                       FAX_NUMBER                                         MOBILE_NUMBER                                      BUSINESS_TYPE  FIELD_REP BILL_TO_CHAIN_ID
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------- ---------- ----------------
    MON_O MON_C TUE_O TUE_C WED_O WED_C THU_O THU_C FRI_O FRI_C SAT_O SAT_C SUN_O SUN_C    ZONE_ID LINE_CHARGE_CLASS   CHAIN_ID CHAIN_CODE PRIMARY_CONTACT_NAME                               PRIMARY_CONTACT_TITLE
    ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---------- ----------------- ---------- ---------- -------------------------------------------------- --------------------------------------------------
    PRIMARY_CONTACT_PHONE                              SECONDARY_CONTACT_NAME                             SECONDARY_CONTACT_TITLE                            SECONDARY_CONTACT_PHONE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    TERTIARY_CONTACT_NAME                              TERTIARY_CONTACT_TITLE                             TERTIARY_CONTACT_PHONE                                BANK_ID BANK_ACCOUNT_ID BANK_ACCOUNT_TYPE BANK_ACCOUNT_DATE   EFT_FLAG FUND_LIMIT INVOICABLE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------- --------------- ----------------- ----------------- ---------- ---------- ----------
       TAXCODE     TAX_ID  SALES_TAX SERVICE_CHARGE INSTANT_CASHING_TYPE INSTANT_TELSEL_REP INSTANT_NUMBER_OF_BINS INSTANT_NUMBER_ITVMS INSTANTCREDIT_LIMIT AUTO_REORDER INSTANT_TERMINAL_REORDER INSTANT_TELSEL_REORDER INSTANT_TELESET_ACTIVE_CDC
    ---------- ---------- ---------- -------------- -------------------- ------------------ ---------------------- -------------------- ------------------- ------------ ------------------------ ---------------------- --------------------------
    INSTANT_INITIAL_DISTRIBUTION AUTO_TELSEL_SCHEDULE INSTANT_AUTO_SETTLE INSTANT_CALL_DAY INSTANT_CALL_WEEK INSTANT_CALL_CYCLE INSTANT_ORDER_RESTRICTION INSTANT_DELIVERY_FLAG INSTANT_ACCOUNT_TYPE INSTANT_SETTLE_CLASS     REGION     COUNTY TERRITORY_X
    ---------------------------- -------------------- ------------------- ---------------- ----------------- ------------------ ------------------------- --------------------- -------------------- -------------------- ---------- ---------- -----------
         ROUTE CHAIN_STATEMENT MASTER_AGENT_ID MINORITY_OWNED TAX_NAME                                        STATE_TAX_ID MAILING_NAME                                          BANK_ACCOUNT_NAME                                 DSR
    ---------- --------------- --------------- -------------- -------------------------------------------------- ------------ -------------------------------------------------- -------------------------------------------------- ----------
             0          1           0               0              0                0          0            1       0                      0        302             0           0                  0                       0
    
                                                                                                                                                                                                                    0          0                0
                                                                                                 0                 0          0
    
                                                                                                                                                                                                0        -2.146E+09          0          0          0
             0                     0              0                    0                  0                      0                    0                   0            0                        0                      0                          0
                               0                    0                   0                1                 0          0                         0                     0                    0                    0          0          0           0
                             0               0              0
    
             1          1  1256213087               0         -39081           -39081          1            2  1256213087                999        302             0           0                  0                       0
    Pseudo Outlet
    
    MU                                                                                                                                               MU
                                                       MU
    MU                                                                                                                                                                                                       0         0                1
    06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59          0              0     0
    
                                                                                                                                                                                                1        -2.146E+09          1          0          1
             0                     0              0                    0                  0                      0                    0                   0            0                        0                      0                      -3287
                               0                    0                   0                1                 1          2                         0                     0                    0                    1          0        999           0
                             5               0              0
    
    SQL>
    

    He dislikes the identifier 'territory', so I renamed it to "territory_x" (I guess that's a reserved word).
    Your initial problem you had was your fields "SEPARATED"... instead of "TERMINATED" by. ;)

  • 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

Maybe you are looking for