Sql loader issue char to date

Hi
I have a text file like this:
logs~-~189.138.221.234~[19/Nov/2007:18:39:53 +0100]~mujer.orange.es~/mujer.woo/home/home/index.html~mujer.woo~home~home~index.html~Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts; InfoPath.2)~bid=1195493283-1925481236; __em_p=1195493283-1925481236%26bid; GUID=0002D029C7BD07412A7C28F861626364~-~?ord=4939922038660
Im trying to load via sql loader to a table like this:
CREATE TABLE SPY_LOGS_FLOGS
TYPE VARCHAR2(10 BYTE),
PROXY VARCHAR2(30 BYTE),
IP VARCHAR2(30 BYTE),
DATETIME DATE,
REFERER VARCHAR2(100 BYTE),
SPY VARCHAR2(100 BYTE),
SPY0 VARCHAR2(100 BYTE),
SPY1 VARCHAR2(100 BYTE),
SPY2 VARCHAR2(100 BYTE),
SPY3 VARCHAR2(100 BYTE),
BROWSER VARCHAR2(300 BYTE),
COOKIE VARCHAR2(100 BYTE),
UNKNOWN VARCHAR2(100 BYTE),
QS VARCHAR2(100 BYTE)
Im using a control similar to this:
LOAD DATA
infile '../files/spy_logs_flogs'
append
into table spy_logs_flogs
FIELDS TERMINATED BY '~'
TRAILING NULLCOLS
TYPE char,
PROXY char,
IP char,
DATETIME date 'to_date(:DATETIME,'"["yyyymmdd hh24:mi:ss"] +100"')' ,
REFERER char,
SPY char,
SPY0 char,
SPY1 char,
SPY2 char,
SPY3 char,
BROWSER char,
COOKIE char,
UNKNOWN char,
qs char
Im trying to transform the DATETIME field from [19/Nov/2007:18:39:53 +0100] to date 19/10/2007 18:39:53, but have tested with control and cant find the way to do it.
Any help will be appreciate.

Play with
select substr('[19/Nov/2007:18:39:53 +0100]',2,20) the_date
  from dualand if you get 19/Nov/2007:18:39:53 proceed to
select to_date('19/Nov/2007:18:39:53','DD/MON/YYYY:HH24:MI:SS')
  from dual
select to_date('19/Nov/2007:18:39:53','DD/Mon/YYYY:HH24:MI:SS')
  from dual
select to_date('19/Nov/2007 18:39:53','DD/MON/YYYY HH24:MI:SS')
  from dual
select to_date('19/Nov/2007 18:39:53','DD/Mon/YYYY HH24:MI:SS')
  from dualperhaps one of those will work (if it's the one without : then you must replace it with space using substr and || before using to_date)
Regards
Etbin

Similar Messages

  • Sql loader error in offline data load

    Hi,
    I have done an offline schema creation using existing tablespace.
    I am trying to do an offline data load using sql loader.The CTL and DAT file are generated by the work bench.
    This is my CTL file code generated by workbench.
    load data
    infile 'Import.dat' "str '<EORD>'"
    into table IMPORT
    fields terminated by '<EOFD>'
    trailing nullcols
    When I am running the ctl file with DAT file in sql loader I am getting the following error
    SQL*Loader-350: Syntax error at line 4.
    Expecting single char, found "<EOFD>".
    fields terminated by '<EOFD>'
    ^
    My Sql Loader version is Release 8.0.6.3.0
    Please help if anyone has came across this issue.
    Thanks in advance.
    Regards
    Saravanan.B

    Saravanan,
    Its a long time since I have seen 8 sql loader. Check the doc. Is it resrticted to a single character delimter??
    Barry

  • How to load XML file to table (non-XML) with SQL*Loader -- issue with nulls

    I have been attempting to use SQL*Loader to load an XML file into a "regular" Oracle table. All fields work fine, unless a null is encountered. The way that nulls are represented is shown below:
    <PAYLOAD>
    <FIELD1>ABCDEF</FIELD1>
    <FIELD2/>
    <FIELD3>123456</FIELD3>
    </PAYLOAD>
    In the above example, FIELD2 is a null field and that is the way it is presented. I have searched everywhere and have not found how I could code for this. The issue is that if FIELD2 is present, it is coded like: <FIELD2>SOMEDATA</FIELD2>, but the null is represented as <FIELD2/>. Here is a sample of the control file I am using to attempt the load -- very simplistic, but works fine when fields are present:
    load data
    infile 'testdata.xml' "str '<PAYLOAD>'"
    TRUNCATE
    into table DATA_FROM_XML
    FIELD1 ENCLOSED BY '<FIELD1>' AND '</FIELD1>',
    FIELD2 ENCLOSED BY '<FIELD2>' AND '</FIELD2>',
    FIELD3 ENCLOSED BY '<FIELD3>' AND '</FIELD3>')
    What do I need to do to account for the way that nulls are presented? I have tried everything I could glean from the web and the documentation and nothing has worked. Any help would be really appreciated.

    I hadn't even got that far. can you direct me to where the docs are to import data that is stored within xml but that you don't need any xml functionality, that just happens to be the format the data is stored in? thx

  • Sql loader issue

    Hi I am trying to use decode function with sql loader.. and gating error
    SQL*Loader-350: Syntax error at line 8.
    Expecting "," or ")", found keyword nullif.
    code(:error_type,'Banned SBI',:error_type)" NULLIF error_type=BLANKS,
    My ctl file is below...
    LOAD DATA
    INFILE 'abc.dat'
    BADFILE 'abc.bad'
    INTO TABLE xyz_tmp
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (record_id INTEGER EXTERNAL(4) NULLIF record_id=BLANKS,
    error_type CHAR(100) "decode(:error_type,'Banned',:error_type)" NULLIF error_type=BLANKS,
    error_subtype CHAR(100) NULLIF error_subtype=BLANKS,
    number_of_errors INTEGER EXTERNAL(3) NULLIF number_of_errors=BLANKS,
    sbi_number INTEGER EXTERNAL(8) NULLIF sbi_number=BLANKS,
    team_name CHAR(60) NULLIF team_name=BLANKS
    Could any one help me to correct it please.

    Hi,
    Try changeing the line with decode to,
    error_type CHAR(100) "decode(trim(:error_type),NULL, NULL,'Banned',:error_type)" ,
    Cheers

  • SQL Loader (how to cut data header)

    Hi there,
    [oracle 11g]
    I got the following text file:
    mod; DD.MM.YYYY; HH:MM:SS; aligned
    src; "ptv "; "15.04.2012"; "10:47:49"
    chs; "ISO8859-1"
    ver; "V1.0"
    ifv; "V1.0"
    dve; "V1.0"
    fft; "LIO"
    tbl; MENGE_FGR
    atr; BASIS_VERSION; FGR_NR; FGR_TEXT
    frm; num[9.0]; num[5.0]; char[40]
    rec;        122;     8; "VVZ"   
    rec;        123;     18; "VHZ"
    rec;        124;     13; "VTZ"    Now I am interested in the column TBL and ATR and follwing rawdata
    Do you see a way to automatically create the table MENGE_FR with columns BASIS_VERSION; FGR_NR;FGR_TEST and column types num, num, char and insert the raw data below?
    PS:OK, this is mysql ...so I need to convert this first to sql. So you should see num as number.
    Thx in advance Thorsten
    Edited by: Thorsten on 16.05.2013 07:30
    Edited by: Thorsten on 16.05.2013 07:32

    There are various ways that you could do this. I have demonstrated one method below. I created a table with two columns, then used SQL*Loader to load the data from the text file into those two columns. Skipping the header rows is optional. You could also use an external table instead, if the text file is on your server, not your client. I then used some PL/SQL to create and execute "create table" and "insert" statements. This is just some starter code. You will need to make modifications to handle other data types and such that were not in the example that you provided, but it should give you the general idea.
    SCOTT@orcl_11gR2> host type text_file.dat
    mod; DD.MM.YYYY; HH:MM:SS; aligned
    src; "ptv "; "15.04.2012"; "10:47:49"
    chs; "ISO8859-1"
    ver; "V1.0"
    ifv; "V1.0"
    dve; "V1.0"
    fft; "LIO"
    tbl; MENGE_FGR
    atr; BASIS_VERSION; FGR_NR; FGR_TEXT
    frm; num[9.0]; num[5.0]; char[40]
    rec;        122;     8; "VVZ"
    rec;        123;     18; "VHZ"
    rec;        124;     13; "VTZ"
    SCOTT@orcl_11gR2> host type test.ctl
    options(skip=7)
    load data
    infile text_file.dat
    into table tbl
    (col1 terminated by ';',
    col2 terminated by x'0a')
    SCOTT@orcl_11gR2> create table tbl
      2    (col1  varchar2(4),
      3     col2  varchar2(60))
      4  /
    Table created.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Thu May 16 13:44:24 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 6
    SCOTT@orcl_11gR2> select * from tbl
      2  /
    COL1 COL2
    tbl   MENGE_FGR
    atr   BASIS_VERSION; FGR_NR; FGR_TEXT
    frm   num[9.0]; num[5.0]; char[40]
    rec          122;     8; "VVZ"
    rec          123;     18; "VHZ"
    rec          124;     13; "VTZ"
    6 rows selected.
    SCOTT@orcl_11gR2> declare
      2    v_tab   varchar2(30);
      3    v_atr   varchar2(32767);
      4    v_frm   varchar2(32767);
      5    v_sql   varchar2(32767);
      6    v_cols  number;
      7    v_next  varchar2(32767);
      8  begin
      9    select col2 into v_tab from tbl where col1 = 'tbl';
    10    select col2 || ';' into v_atr from tbl where col1 = 'atr';
    11    select col2 || ';' into v_frm from tbl where col1 = 'frm';
    12    v_sql := 'CREATE TABLE ' || v_tab || ' (';
    13    select regexp_count (col2, ';') + 1 into v_cols from tbl where col1 = 'atr';
    14    for i in 1 .. v_cols loop
    15      v_sql := v_sql || substr (v_atr, 1, instr (v_atr, ';') - 1) || ' ';
    16      v_next := substr (v_frm, 1, instr (v_frm, ';') - 1);
    17      v_next := replace (v_next, '[', '(');
    18      v_next := replace (v_next, ']', ')');
    19      v_next := replace (v_next, '.', ',');
    20      v_next := replace (v_next, 'num', 'number');
    21      v_next := replace (v_next, 'char', 'varchar2');
    22      v_sql := v_sql || v_next || ',';
    23      v_atr := substr (v_atr, instr (v_atr, ';') + 1);
    24      v_frm := substr (v_frm, instr (v_frm, ';') + 1);
    25    end loop;
    26    v_sql := rtrim (v_sql, ',') || ')';
    27    dbms_output.put_line (v_sql);
    28    execute immediate v_sql;
    29    for r in (select col2 from tbl where col1 = 'rec') loop
    30      v_sql := 'INSERT INTO ' || v_tab || ' VALUES (''';
    31      v_sql := v_sql || replace (replace (r.col2, ';', ''','''), '"', '');
    32      v_sql := v_sql || ''')';
    33      dbms_output.put_line (v_sql);
    34      execute immediate v_sql;
    35    end loop;
    36  end;
    37  /
    CREATE TABLE  MENGE_FGR ( BASIS_VERSION  number(9,0), FGR_NR  number(5,0),
    FGR_TEXT  varchar2(40))
    INSERT INTO  MENGE_FGR VALUES ('        122','     8',' VVZ')
    INSERT INTO  MENGE_FGR VALUES ('        123','     18',' VHZ')
    INSERT INTO  MENGE_FGR VALUES ('        124','     13',' VTZ')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> describe menge_fgr
    Name                                      Null?    Type
    BASIS_VERSION                                      NUMBER(9)
    FGR_NR                                             NUMBER(5)
    FGR_TEXT                                           VARCHAR2(40)
    SCOTT@orcl_11gR2> select * from menge_fgr
      2  /
    BASIS_VERSION     FGR_NR FGR_TEXT
              122          8  VVZ
              123         18  VHZ
              124         13  VTZ
    3 rows selected.

  • SQL*Loader issue with NULLIF

    Hi all,
    I am trying to use following control file,
    LOAD DATA
    INFILE *
    REPLACE
    INTO TABLE T1
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS
    OBJECT_NAME           CHAR              NULLIF OBJECT_NAME = "NULL" ,
    SUBOBJECT_NAME        CHAR              NULLIF SUBOBJECT_NAME = "NULL" ,
    OBJECT_ID             DECIMAL EXTERNAL  NULLIF OBJECT_ID = "NULL" ,
    DATA_OBJECT_ID        DECIMAL EXTERNAL  NULLIF DATA_OBJECT_ID = "NULL" ,
    OBJECT_TYPE           CHAR              NULLIF OBJECT_TYPE = "NULL" ,
    CREATED               DATE  "DD/MM/YYYY HH24:MI:SS" NULLIF CREATED = "NULL" ,
    LAST_DDL_TIME         DATE  "DD/MM/YYYY HH24:MI:SS" NULLIF LAST_DDL_TIME = "NULL" ,
    TIMESTAMP             CHAR              NULLIF TIMESTAMP = "NULL" ,
    STATUS                CHAR              NULLIF STATUS = "NULL" ,
    TEMPORARY             CHAR              NULLIF TEMPORARY = "NULL" ,
    GENERATED             CHAR              NULLIF GENERATED = "NULL" ,
    SECONDARY             CHAR              NULLIF SECONDARY = "NULL"
    )I am getting error,
    SQL*Loader-350: Syntax error at line 21.
    Expecting positive integer or column name, found keyword timestamp.
                                CHAR  NULLIF TIMESTAMP = "NULL" ,
    STATUSThe file I am trying to load is a pipe delimited file and has a string "NULL" for NULL values. So, I have added NULLIF for all columns.
    Interesting thing is, Oracle allows us to have column names like TIMESTAMP or GENERATED, but I use it in the NULLIF clause, it is effectively syntax error.
    The table I am using is like this (it is same as user_objects view),
    SQL> desc t1
    Name                          Null?    Type
    OBJECT_NAME                            VARCHAR2(128)
    SUBOBJECT_NAME                         VARCHAR2(30)
    OBJECT_ID                              NUMBER
    DATA_OBJECT_ID                         NUMBER
    OBJECT_TYPE                            VARCHAR2(19)
    CREATED                                DATE
    LAST_DDL_TIME                          DATE
    TIMESTAMP                              VARCHAR2(19)
    STATUS                                 VARCHAR2(7)
    TEMPORARY                              VARCHAR2(1)
    GENERATED                              VARCHAR2(1)
    SECONDARY                              VARCHAR2(1)If I remove the NULLIF clause for columns, timestamp and generated, there is no problem, the control file works fine.
    How can I get around this problem ?
    Thanks in advance

    TIMESTAMP is a keyword for the loader and confuses it.
    rename your column

  • SQL*Loader Error Field in data file exceeds maximum length", version 8.1.6

    Hi All,
    I am trying to load a data file into a database table using SQL loader. I
    received the data in an data file but I saved it as a pipe delimited
    file.
    When I run the SQL Loader command no records are loaded - looking at the log
    file I get the following error:
    Rejected - Error on table FARESDATA, column FANOTESIN.
    Then I tried with substr and doesnt seem to work for values greater than 4000 chars, it only works if the field value is below 4000 chars (say doing a substr for first 3000 chars).
    see the code--------
    LOAD DATA
    INFILE 'p.dat'
    APPEND INTO TABLE PROSPECTUS
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    Fanotesin char(4000) "substr(:fanotesin,1,4000)"
    We get the error ORA-01461: can bind a LONG value only for insert into a LONG column when using substr for 4000 chars.
    Please help!
    Thanks,
    Rajesh
    null

    I believe the problem here is that the ORACLE database regards anything > 4000chs as a CLOB (or LONG). 4000 is the maximum length of a varchar2 field in the database, although of course you can declare larger values in PL/SQL. (Since the incoming data is > 4000 chs it is regarded as a LONG and you cannot therefore use SUBSTR on it)
    I think that you must either truncate your data before loading or load into a table with the offending field as a CLOB (or LONG)
    and then use PL/SQL to recreate it in a table with a varchar2(4000) which is otherwise identical. (You can select from a LONG into a varchar2(32000) for example and then truncate before writing out to the new table).

  • Sql loader special char loading in table

    Hi all,
    I am using oracle 10g with UNIX.
    I have a .csv file transferred from windows to UNIX. I check the control M char and remove them
    using dos2unix command.
    The special char name are fine in UNIX for eg as below when check the .csv file after trnasfered
    Oulu
    Jääli
    HaukipudasI use SQL LOADER to load into database a temp table. as below control file
    OPTIONS (SKIP=1)
    LOAD DATA CHARACTERSET UTF8
    INSERT INTO TABLE temp_pa_load
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY  '"' TRAILING NULLCOLS
    (id_id,
    name)
    {code}
    The fields id is map to id and name is map to name in temp table
    when check in temp table after sql loader is executed i get incorrect name
    actual name in .csv file   Jääli
    temp table name    J�i
    the rest names and id are correct but only for special char there is problem
    the size of name column in temp table is 100 varchar2
    I also tried to specify char(100) in control file but it didn;t work
    could some one pls advice me.
    thanks in advance
    Saaz Ena                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Pl post the characterset of the database, along with a description of the table.
    HTH
    Srini

  • SQL Loader Approch to fetch data from Previous Data Segment.

    CREATE TABLE T
    RECORD_ID NUMBER,
    SEG_VALUES VARCHAR2(4000)
    ==============================================================================
    LOAD DATA
    INFILE *
    TRUNCATE
    INTO TABLE T
    WHEN SEG_VALUES <> ''
    RECORD_ID RECNUM,
    SEG_VALUES POSITION(1:4000)
    BEGIN DATA
    AAASH9561000000074120081029SYS
    BBB0000001H0351
    CCC0000001 6040818 078141532A 202007083020070830 36274
    CCC0000002 12623239 526486168A 202008063020080630 4808
    CCC0000003 13326331 530229550A 202008042620080426 V4611
    CCC0000004 23554261 161340499A 202008082220080822 6868
    ==============================================================================
    CREATE TABLE T1
         FILE_ID VARCHAR2(20),
         CONT_NBR VARCHAR2(20),
         SEG_VALUES VARCHAR2(4000)
    ==============================================================================
    CREATE OR REPLACE PROCEDURE P
    AS
    l_Fileid T1.file_id%type;
    l_Contractnbr t1.CONT_NBR%Type;
    BEGIN
         FOR REC IN (SELECT SEG_VALUES FROM T ORDER BY RECORD_ID)
         LOOP
              IF SUBSTR(REC.SEG_VALUES,1,3) ='AAA' THEN
                   l_Fileid := SUBSTR(REC.SEG_VALUES,10,10);
              ELSIF SUBSTR(REC.SEG_VALUES,1,3) ='BBB' THEN
                   l_Contractnbr := SUBSTR(REC.SEG_VALUES,11,5);
              ELSIF SUBSTR(REC.SEG_VALUES,1,3) ='CCC' THEN
                   INSERT INTO T1 VALUES (l_Fileid,l_Contractnbr,REC.SEG_VALUES);               
    END IF;
         END LOOP;
         COMMIT;
    EXCEPTION
         WHEN OTHERS THEN
         RAISE_APPLICATION_ERROR (-20458,SQLERRM);
    END P;
    ==============================================================================
    Is there is any simple approch to handle the above scenario in SQL Loader Control file? if possible can you please show me?

    Handle the above scenario? What above scenario?
    Could I guess ... you betcha. Will I guess? Quite another matter.
    Please provide full version (all 3 decimal places) and a clear and concise description of what help you need.

  • SQL Loader - want to access data from .txt file but don't want to insert

    Hello,
    I have situation where I have some data in .txt file and I have to load that data into one of my table.
    My problem is I have fundtion get_id(a,b,c) in database which I have to call while loading the data to find out value of x.
    I have value of a, b and c in txt file which I can access it using POSITION(N:M) in sql loader, but After accessing that value I just want to past to get_id() function and dont want to insert into sql loader.
    any help

    My control file is as below
    Following field is not in database but I need to pass the value to the function to get a ESC_USER_ID. any help
    OFFICE_NUM      filler POSITION(32:35) ,
    STATION_DESK      filler POSITION(45:48),
    LOAD DATA
    INFILE REFERRALs.TXT
    BADFILE REFERRAL_LOAD.BAD
    DISCARDFILE REFERRAL_LOAD.DIS
    INSERT
    INTO TABLE REFERRAL
    EVALUATE CHECK_CONSTRAINTS REENABLE DISABLED_CONSTRAINTS
    TRAILING NULLCOLS
    ID                    sequence (1,1),
    JOB_ID                    POSITION (16:22) "GET_JOB_ID(:JOB_ID)"      ,
    CUS_ID                    POSITION (23:31) "GET_CUS_ID(:CUS_ID)"     ,
    STATUS_LU               CONSTANT 'F'                    ,     
    REQUEST_USER_TYPE_LU          CONSTANT 'S'                    ,
    OFFICE_NUM      filler POSITION(32:35) ,
    STATION_DESK      filler POSITION(45:48),
    REQUEST_USER_ID          POSITION(143:149) "GET_ESCUSER_ID(OFFICE_NUM,STATION_DESK,:REQUEST_USER_ID)"     ,
    REQUEST_DT               POSITION (37:44) "to_date(:REQUEST_DT,'YYYY/MM/DD')"     ,
    REVIEW_USER_ID               FILLER                         ,
    REVIEW_DT               FILLER                         ,
    REFUSE_REASON_LU          FILLER                         ,
    RESULT_LU               POSITION (97:97)               ,
    NOTIFY_STATUS_LU          FILLER                         ,
    NOTIFY_DT               FILLER                         ,
    APPOINTMENT_DT               POSITION (106:113) "to_date(:APPOINTMENT_DT,'YYYY/MM/DD')"     ,
    RESULT_DT               POSITION (98:105) "to_date(:RESULT_DT,'YYYY/MM/DD')"     ,
    NO_MATCH_IND               CONSTANT 'N'
    )

  • SQL*Loader issue with WHEN command

    Environment: R12.1.2
    We have a file coming in from a bank that needs to be loaded into a custom table using SQL*Loader.
    The file has multiple record formats. Each record in the file starts with a "record type", which defines the format.
    For simplicity, let me say that there is a record type of "H" with the header format, and another record type "D" has a detail record format. An "H" record may be followed by multiple "D" records until the next "H" record is encountered. Unfortunately, there is no common key, like say "Vendor Number" in both the "H" and "D" records to establish a relationship. So the plan was to use a Oracle sequence or SQL*Loader sequence to get a sequence loaded into the table as the file is being loaded. Then if consecutive "H" records had a sequence value of 100 and 112, we would know that the "D" records for the "H" 100 record are all the records with sequence value of 101 through 111.
    The issue occurs as we have to use the WHEN command in the control file to direct a certain record type to specific columns of the table. Based on the populated sequence values, with the WHEN command, it seems that all the "H" records get loaded first followed by the "D" records. The sequence becomes of no use and we cannot establish a link between the "H" and "D" records. The alternative is to not use WHEN with the sequence, but load the file into generic column names which provides for less understanding in the application.
    Is there a way (command feature) to ensure that SQL*Loader loads the records sequentially while using WHEN?
    Thanks
    Satish

    I used RECNUM parameter instead of sequence and it worked fine

  • SQL Loader ISSUE- when invoking function in a package - in Direct Path- SPK

    This is the loader file a.ctl
    load data
    append
    into table emp
    when eno='4'
    (eno number,
    ename varchar2(20))
    when (1)<>'4'
    into table detpt
    (deptno number,
    deplogid "Log.get_logid('logid')"
    Note: the deptlogid field is not null column.
    The par fie is as follows
    rows=1000
    errors=0
    direct=true
    control=a.ctl
    when i am running this file i am getting error when i am invoking the package Log.get_logid('logid')" in direct mode. It returns null value when it is used in control file.
    1) if i am running this function in sql prompt like
    select Log.get_logid('logid') from dual
    i am getting result as 121.
    2) what is the problem when the same function is used in Sql loader in direct mode.
    3) is there any restriction to use the function in sql loader?
    4) whether to use the function in sql loader is applicable for direct mode or conventional mode.
    5) when i am running in conventional mode it is working fine . what is the reason??
    I am running the loader from dos prompt like
    c:> sqlldr scott/tiger@dev parfile=abc.par
    Oracle 9i is the version for the loader.
    Please help me out to solve the issue

    This is the loader file a.ctl
    load data
    append
    into table emp
    when eno='4'
    (eno number,
    ename varchar2(20))
    when (1)<>'4'
    into table detpt
    (deptno number,
    deplogid "Log.get_logid('logid')"
    Note: the deptlogid field is not null column.
    The par fie is as follows
    rows=1000
    errors=0
    direct=true
    control=a.ctl
    when i am running this file i am getting error when i am invoking the package Log.get_logid('logid')" in direct mode. It returns null value when it is used in control file.
    1) if i am running this function in sql prompt like
    select Log.get_logid('logid') from dual
    i am getting result as 121.
    2) what is the problem when the same function is used in Sql loader in direct mode.
    3) is there any restriction to use the function in sql loader?
    4) whether to use the function in sql loader is applicable for direct mode or conventional mode.
    5) when i am running in conventional mode it is working fine . what is the reason??
    I am running the loader from dos prompt like
    c:> sqlldr scott/tiger@dev parfile=abc.par
    Oracle 9i is the version for the loader.
    Please help me out to solve the issue

  • SQL Loader Error : ORA-01830: date format picture ends before converting en

    I am inserting following data
    BES101706     M.E. Deals     7     10/17/2006
    through control file :
    LOAD DATA
    APPEND
    INTO TABLE abc_temp
    FIELDS TERMINATED BY ' '
    TRAILING NULLCOLS
    (BATCH_NAME               ,
    SUPPLIER_NAME          ,
    SUPPLIER_NBR          ,
    INV_DATE "to_date(substr(:INV_DATE,1,10),'MM/DD/YYYY' )"
    But I am getting this error:
    ORA-01830: date format picture ends before converting entire input string
    inv_data is a date field in the database.

    I think it has to do with data format.Exactly.
    You have
    BES101706*M.E.*Deals*7*10/17/2006
    I replace each space with an asterisk. You have 5 columns according to your spec (terminated by '<space>')
    SQL Loader doesn't know that M.E. Deals is the supplier name.
    It's trying to convert 7 as the date.

  • SQL Loader - double quote within data

    Hi,
    I'm putting together some SQL loader scripts to load source data into a DB. The data we are receiving is comma delimited, optionally enclosed by double quotes (").
    e.g. "abc","123","this is a "test"","987"
    The problem I've got is that some data items contain double quotes ("test") as part of the data and this cause the SQL Loader to fall over with the error:
    Record 14644: Rejected - Error on table x, column y.
    no terminator found after TERMINATED and ENCLOSED field
    Is it possible to load this without changing the extraction process from the source system?
    My .ctl file looks like this:
    LOAD DATA
         INFILE '../data/toload/BR_ADDRESS.CSV'
         APPEND INTO TABLE STA_COMP_BRADD
         FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
         etc....
    Message was edited by:
    MaximumStagg

    Hi,
    Look in to this in Oracle documentation:
    "If two delimiter characters are encountered next to each other, a single occurrence of the delimiter character is used in the data value. For example, 'DON''T' is stored as DON'T. However, if the field consists of just two delimiter characters, its value is null."
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm
    Thanks,
    Kishore

  • SQL Loader Issues

    I'm trying to lad a file into Oracle and I getting errors like:
    Record 1: Rejected - Error on table "DW_SUPPORT"."ISAEO", column CLASS_CDE.
    Variable length field exceeds maximum length.
    This is for all my columns. Oracle is giving me different column widths than for the ones I've specified. In my control file, I've put:
    OPTIONS ( SKIP=1, DIRECT=TRUE)
    LOAD DATA
    INFILE 'C:\CBOE\ICS\isaback_shrt.dat' "fix 89 "
    BADFILE 'C:\CBOE\ICS\isaback_shrt.bad'
    DISCARDFILE 'C:\CBOE\ICS\isaback_shrt.dsc'
    INTO TABLE "DW_SUPPORT"."ISAEO"
    INSERT
    (CLASS_CDE POSITION (1:5) VARCHAR (5),
    PUT_CALL_IND POSITION (6:6) VARCHAR (1),
    EXPR_YR_DTE POSITION (7:8) VARCHAR (2),
    EXPR_MO_DTE POSITION (9:10) VARCHAR (2),
    EXER_PRC_INT POSITION (11:13) VARCHAR (3),
    EXER_PRC_FRC POSITION (14:14) VARCHAR (1),
    QUO_MO_SYM_CDE POSITION (15:15) VARCHAR (1),
    QUO_PRC_SYM_CDE POSITION (16:16) VARCHAR (1),
    SERS_ACTV_DTE POSITION (17:22) VARCHAR (6),
    SERS_INACT_DTE POSITION (23:28) VARCHAR (6),
    SERS_LSTMOD_DTE POSITION (29:34) VARCHAR (6),
    DEC_FRAC_IND POSITION (35:35) VARCHAR (1),
    FOUR_DIG_STRK POSITION (36:36) VARCHAR (1),
    FIVE_DIG_STRK POSITION (37:37) VARCHAR (1),
    FILLER POSITION (38:39) VARCHAR (2),
    RAES_VOL_QTY POSITION (40:44) VARCHAR (5),
    CARS_VOL_QTY POSITION (45:49) VARCHAR (5),
    EXPR_RESN_CDE POSITION (50:50) VARCHAR (1),
    AS_OF_CC POSITION (51:52) VARCHAR (2),
    AS_OF_YY POSITION (53:54) VARCHAR (2),
    AS_OF_MM POSITION (55:56) VARCHAR (2),
    AS_OF_DD POSITION (57:58) VARCHAR (2),
    FILLER2 POSITION (59:89) VARCHAR (31))
    But Oracle, for some reason, has added two extra characters to each column giving me:
    Table "DW_SUPPORT"."ISAEO", loaded from every logical record.
    Insert option in effect for this table: INSERT
       Column Name                  Position   Len  Term Encl Datatype
    CLASS_CDE                             1:5     7           VARCHAR             
    PUT_CALL_IND                          6:6     3           VARCHAR             
    EXPR_YR_DTE                           7:8     4           VARCHAR             
    EXPR_MO_DTE                          9:10     4           VARCHAR             
    EXER_PRC_INT                        11:13     5           VARCHAR             
    EXER_PRC_FRC                        14:14     3           VARCHAR             
    QUO_MO_SYM_CDE                      15:15     3           VARCHAR             
    QUO_PRC_SYM_CDE                     16:16     3           VARCHAR             
    SERS_ACTV_DTE                       17:22     8           VARCHAR             
    SERS_INACT_DTE                      23:28     8           VARCHAR             
    SERS_LSTMOD_DTE                     29:34     8           VARCHAR             
    DEC_FRAC_IND                        35:35     3           VARCHAR             
    FOUR_DIG_STRK                       36:36     3           VARCHAR             
    FIVE_DIG_STRK                       37:37     3           VARCHAR             
    FILLER                              38:39     4           VARCHAR             
    RAES_VOL_QTY                        40:44     7           VARCHAR             
    CARS_VOL_QTY                        45:49     7           VARCHAR             
    EXPR_RESN_CDE                       50:50     3           VARCHAR             
    AS_OF_CC                            51:52     4           VARCHAR             
    AS_OF_YY                            53:54     4           VARCHAR             
    AS_OF_MM                            55:56     4           VARCHAR             
    AS_OF_DD                            57:58     4           VARCHAR             
    FILLER2                             59:89    33           VARCHAR              So it's giving me errors like:
    SQL*Loader-307: Warning: conflicting lengths 5 and 7 specified for column CLASS_CDE table "DW_SUPPORT"."ISAEO"
    I have no idea why its done this. It looks like it thinks I have spaces between my fields. Since I'm working with fixed width input fields do I somehow need to specify that I there are no spaces between fields? What do I need to do?

    If you have some way for SQL Loader to identify that the the record is split or if you can alter how the files are generated to include a set character at the start of a record then you should be able to do this using CONTINUEIF.
    If you can insert a character say $$ at the start of the record then include continueif this (1:2) = '%%' in the control file.
    Other than that, it will depend on the format of your file. If your first field is always 3 characters wide you could do continueif this preserve (3:3) = ',' If it happens that the CR/LF occurs just before the closing quotes you could try continueif next preserve (1:1) = '"' Anything else and its going to be pretty difficult...

Maybe you are looking for

  • Can't switch between  fill and outline.

    Here's the problem: I'm on an iMac, new, trying to use illustrator CS5. after using CS3 for a few years. In CS5, if I draw a shape, flat, in the illustration, then try to give it an outline, or change the outline, or do anything with the outline, I c

  • Can anyone tell me where I can find a beginners guide to the filing system?

    Can anyone tell me where I can find a beginners guide to the filing system on the Macbook Air iOS 10.9.4?

  • Getting file name and date taken to appear in thumbnails

    How do I get my thumbnails in Media to show the file name of each photo and also the date taken? Right clicking on the thumbnail reflects that the "show file info" box is checked. I have Elements 11 (was using Elements 6) and the operating system in

  • Oracle 10g (OEM)

    I have installed oracle 10g 10.0.1 successfully yesterday (06/25/05), but this morning (06/26/05) when I tried to start the OEM(Oracle Enterprise Manager)http://namecomputer:5500/em it sent me to the following page. Database: venus The database statu

  • I would like to only occasionally use a external editor

    If iPhoto won't do the job I would occasional like to click on external editor. When I do, I get adobe. How can I change it to a different external editor. I know I can change it in Preferences but then I get the external editor every time. I have an