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

Similar Messages

  • Does resteasy API have class loader issues when using via OSGi

    Does resteasy API have class loader issues when using via OSGi

    Hi Scott,
    THis isnt an answer to ur Question, but could u tell me which jar files are needed for the packages:
    com.sap.portal.pcm.system.ISystems
    com.sap.portal.pcm.system.ISystem
    and under which path I coul dfind them.
    Thnx
    Regards
    Meesum.

  • 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 with WHEN

    I'm using Oracle 11g, Win XP.
    I'm trying to load data with below control file:
    OPTIONS (SKIP=0, DIRECT=FALSE, PARALLEL=FALSE, BINDSIZE=50000, errors=999999,ROWS=200, READSIZE=65536)
    LOAD DATA
    APPEND
    INTO TABLE v_table
    when COL_3  = 'XXXX'
    fields terminated by "|" optionally enclosed by '"'
    trailing nullcols
    COL_1  "trim(:COL_1)",
    COL_2  "trim(:COL_2)",
    COL_3  "trim(:COL_3)",
    COL_4  "trim(:COL_4)",
    COL_5  "trim(:COL_5)",
    COL_6  "trim(:COL_6)",
    COL_7  "trim(:COL_7)",
    INTO TABLE v_table
    APPEND
    when  COL_3 = 'YYY'
    fields terminated by "|" optionally enclosed by '"'
    trailing nullcols
    COL_1  "trim(:COL_1)",
    COL_2  "trim(:COL_2)",
    COL_3  "trim(:COL_3)",
    COL_4  "trim(:COL_4)",
    COL_5  "trim(:COL_5)",
    COL_6  "trim(:COL_6)",
    COL_7  "trim(:COL_7)",
    )Below is the sample data in the data file:
    33432|"ORACLE"|"XXXX"|"555827             "|"317564"|" "|""|"ORACLE "|2011-07-20-15.37.11.879915|0001-01-01-01.01.01.000001
    33433|"ORACLE"|"XXXX"|"555828             "|"317564"|" "|""|"ORACLE "|2011-07-24-15.37.11.879915|0001-01-01-01.01.01.000001
    33434|"ORACLE"|"XXXX"|"555829             "|"317564"|" "|""|"ORACLE "|2011-07-10-15.37.11.879915|0001-01-01-01.01.01.000001
    33435|"ORACLE"|"XXXX"|"555830             "|"317564"|" "|""|"ORACLE "|2011-07-22-15.37.11.879915|0001-01-01-01.01.01.000001
    33436|"ORACLE"|"XXXX"|"555831             "|"317564"|" "|""|"ORACLE "|2011-07-20-15.37.11.879915|0001-01-01-01.01.01.000001
    33437|"ORACLE"|"XXXX"|"555832             "|"317564"|" "|""|"ORACLE "|2011-07-20-15.37.11.879915|0001-01-01-01.01.01.000001
    40048|"SAS"|"ZZZ "|"1017838            "|"317551"|" "|""|"COD "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    40049|"SAS"|"ZZZ "|"1017839            "|"317551"|" "|""|"COD "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    40050|"SAS"|"ZZZ "|"1017840            "|"317551"|" "|""|"COD "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    20046|"SUNUSA"|"YYY "|"1017836            "|"317551"|" "|""|"JAVA "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    20047|"SUNUSA"|"YYY "|"1017837            "|"317551"|" "|""|"JAVA "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    20048|"SUNUSA"|"YYY "|"1017838            "|"317551"|" "|""|"JAVA "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    20049|"SUNUSA"|"YYY "|"1017839            "|"317551"|" "|""|"JAVA "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001
    20050|"SUNUSA"|"YYY "|"1017840            "|"317551"|" "|""|"JAVA "|2011-09-08-08.44.29.684915|0001-01-01-01.01.01.000001Issue is:
    When I'm loading data in the table with the above control card, only data with when COL_3 = 'XXXX' is getting loaded. And if I comment the block which has COL_3 = 'XXXX', then the second block is getting loaded (when COL_3 = 'YYY'). But I'm unable to load data for XXXX and YYY in single load. Can someone please help me on this?

    Thanks Warren. Found the solution.
    when COL_3 = 'XXXX'
    fields terminated by "|" optionally enclosed by '"'
    trailing nullcols
    COL_1 *POSITION(1)* "trim(:COL_1)",
    COL_2 "trim(:COL_2)",
    COL_3 "trim(:COL_3)",
    COL_4 "trim(:COL_4)",
    COL_5 "trim(:COL_5)",
    COL_6 "trim(:COL_6)",
    COL_7 "trim(:COL_7)",
    INTO TABLE v_table
    APPEND
    when COL_3 = 'YYY'
    fields terminated by "|" optionally enclosed by '"'
    trailing nullcols
    COL_1 POSITION(1) "trim(:COL_1)",
    COL_2 "trim(:COL_2)",

  • 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 Problem when data is loaded but not come in standard formate

    Hi guys,
    I got problem when sql loader run data loaded successfully in table but UOM data not come in standard formate.
    UOM table column contains the Unit of measure data but in my excel sheet it's look like :
    EXCEl SHEET DATA:
    1541GAFB07080          0     Metres
    1541GAFE10040          109.6     Metres
    1541GAFE10050          594.2     Metres
    1541GAFE10070          126.26     Metres
    1541GAFE14040          6.12     Metres
    1541GAFE14050          0     Metres
    1541SAFA05210          0     Metres
    1541SAFA07100          0     Metres
    1551EKDA05210          0     Nos
    1551EKDA07100          0     Nos
    1551EKDA07120          0     Nos
    1551EKDA07140          0     Nos
    1551EKDA07200          0     Nos.
    1551EKDA08160          0     Nos.
    1551EKDA08180          0     Nos.
    1551EKDA08200          0     Nos.
    1551EKDA10080          41     Nos.
    1551EKDA10140          85     Nos.
    .ctl file :
    OPTIONS (silent=(header,feedback,discards))
    LOAD DATA
    INFILE *
    APPEND
    INTO TABLE XXPL_PO_REQUISITION_STG
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY'"'
    TRAILING NULLCOLS
    ( ITEM_CODE CHAR,
    ITEM_DESCRIPTION CHAR "TRIM(:ITEM_DESCRIPTION)",
    QUANTITY,
    UOM,
    NEED_BY_DATE,
    PROJECT,
    TASK_NAME,
    BUYER,
    REQ_TYPE,
    STATUS,
    ORGANIZATION_CODE,
    LOCATION,
    SUBINVENTORY,
    LINE_NO,
    REQ_NUMBER,
    LOADED_FLAG CONSTANT 'N',
    SERIAL_NO "XXPL_PRREQ_SEQ.NEXTVAL",
    CREATED_BY,
    CREATION_DATE SYSDATE,
    LAST_UPDATED_BY,
    LAST_UPDATED_DATE,
    LAST_UPDATED_LOGIN
    Some output came in table like:
    W541WDCA05260 0 Metres|
    W541WDCA05290 3 Metres|
    W541WDCA05264 4 Metres|
    W541WDCA05280 8 Metres|
    1551EADA04240 0 Nos|
    1551EADA07100 0 Nos|
    1551EKDA10080 0 Nos.|
    1551EKDA10080 41 Nos.|
    proble in | delimiter...how to remove it ' | ' from my table when sqlloader program runnig ...... where i can change in .ctl file or excel file....it's urgent guys olz help me ..
    thanks

    Hi,
    How are you extracting the data to Excel sheet ?
    Please check the format type of the column in Excel sheet for UOM.
    There is no issue in the SQL loader control file, but issue is there in your source excel file. (Try using a different method to extract the data to Excel sheet.)
    Regards,
    Yuvaraj.C

  • Sql loader using position and functions

    Hi all, i need help loading some data in my table using sql loader. consider the following
    CREATE TABLE er
    a1 NUMBER,
    a2 number,
    a3 VARCHAR2(100),
    a4 VARCHAR2(100),
    a5 VARCHAR2(100),
    a6  VARCHAR2(100),
    a7  VARCHAR2(100),
    a8  VARCHAR2(100)
    OPTIONS (BINDSIZE=20548000, READSIZE=20548000, STREAMSIZE=20548000, DATE_CACHE=25000,  SKIP=0)
    LOAD DATA
    INTO TABLE er
    APPEND    
    TRAILING NULLCOLS
      a1            POSITION(0001:0021)               ,
      a2            POSITION(0022:0042)       "DECODE(SUBSTR(:a2,1,3),'***',NULL,:a2)"      ,
      a3            POSITION(0043:0053)       ,
      a4            POSITION(0054:0064)          ,
      a5            POSITION(0065:0075)           ,
      a6            POSITION(0076:0086)       ,
      a7            POSITION(0087:0093)      "DECODE(SUBSTR(:a7,1,3),'***',NULL,:a7)"  
    BEGIN
                     0.00 ******************** X          X          X          *X          ****
    END;if you look at the data, some fields have a lot of * and some has af few such as ****. i want to load this data into a table and when a field contain all * as a value, i want to set it to null. if a field contain a * and alphanumeric then that value should be load as it is.
    in the example above, ******************** should be set to null and **** should also be set to null. notice that there is a field with X. since this field contain alpha numeric, it should be loaded into the table as is.  the only time field should be set to null is when the value contain all .
    somebody in this forum suggest using decode but it looks like it is not working and i get error when it reads second field and try to insert into a2 number column.
    is there any way to use regular expression to find out if a field contain all *. also i want to trim each field since they might contain leading spaces.
    can some one help with this using the sqlloader ctl and data above?

    You can include regular expression in you SQL*Loader control file.
    An example can be found here:
    http://www.morganslibrary.org/reference/sqlloader.html
    Demos 7 and 8 using the UPPER and DECODE functions to illustrate how to do it.

  • 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

  • PL/SQL speed issues when using a variable

    I have a very strange issue that is causing problems.
    I am running Golden connecting to a 11g database.
    I created a procedure to insert records into a table based on a query. The source query includes variables that I have populated prior to the insert statement. The problem is that if I use the variable for one very specific where statement, the statement goes from running in less than 1 second, to running in 15 minutes. It gets even more strange though. Not only does a 2nd variable not cause any problems, the exact same variable in the same statement works fine.
    This procedure takes 15 minutes to run.
    declare
        v_start_period date;
        v_end_period date;
    begin
        select add_months(trunc(sysdate,'mm'), -1), trunc(sysdate,'mm')
        into v_start_period, v_end_period
        from dual;
        insert into RESULTS_TABLE
                (first_audit_date, last_audit_date,
                data_column1, data_column2, data_column3)
            select
                a.first_audit_date, a.last_audit_date,
                b.data_column1, b.data_column2, b.data_column3
            from
                SOURCE_TABLE_1 b,
                (select marker_id, min(action_time) as first_audit_date, max(action_time) as last_audit_date
                    from SOURCE_TABLE_2
                    where action_time >= v_start_period and action_time < v_end_period
                    group by marker_id) a
            where b.marker_id = a.marker_id
                and exists (select 1 from SOURCE_TABLE_2
                    where marker_id = b.marker_id
                    and action_time >= v_start_period and action_time < v_end_period
                    and action_type = 'XYZ');
        commit;
    end;This procedure runs in less than 1 second, yet returns the exact same results.
    declare
        v_start_period date;
        v_end_period date;
    begin
        select add_months(trunc(sysdate,'mm'), -1), trunc(sysdate,'mm')
        into v_start_period, v_end_period
        from dual;
        insert into RESULTS_TABLE
                (first_audit_date, last_audit_date,
                data_column1, data_column2, data_column3)
            select
                a.first_audit_date, a.last_audit_date,
                b.data_column1, b.data_column2, b.data_column3
            from
                SOURCE_TABLE_1 b,
                (select marker_id, min(action_time) as first_audit_date, max(action_time) as last_audit_date
                    from SOURCE_TABLE_2
                    where action_time >= v_start_period and action_time < trunc(sysdate,'mm')
                    group by marker_id) a
            where b.marker_id = a.marker_id
                and exists (select 1 from SOURCE_TABLE_2
                    where marker_id = b.marker_id
                    and action_time >= v_start_period and action_time < v_end_period
                    and action_type = 'XYZ');
        commit;
    end;The only difference between the two is where I replace the first v_end_period variable with trunc(sysdate,'mm').
    I've been googling for possible solutions and keep running into something called "parameter sniffing". It appears to be a SQL Server issue though, as I cannot find solutions for Oracle. I tried nesting the insert statement inside it's own procedure with new variables populated by the old variables, but nothing changed.
    Edited by: user_7000017 on Jan 8, 2013 9:45 AM
    Edited by: user_7000017 on Jan 8, 2013 9:52 AM Put the code in code tags.

    You are not describing procedures. You are listing anonymous PL/SQL blocks.
    As for the code - this approach to assigning PL/SQL variables are highly questionable. As the functions are native PL/SQL functions too, there is no need to parse and execute a SQL cursor, do context switching, in order to assign values to PL/SQL variables.
    This is wrong:
    select
        add_months(trunc(sysdate,'mm'), -1), trunc(sysdate,'mm')
        into v_start_period, v_end_period
    from dual;This is correct:
    v_start_period := add_months(trunc(sysdate,'mm'), -1);
    v_end_period := trunc(sysdate,'mm');Just as you would not use +"select 1 into plVariable from dual;+", instead of a standard variable assignment statement like +"plVariable := 1;"+.
    As for the performance/execution difference. Does not make sense. I suggest simplifying the code in order to isolate the problem. For example, take that in-line SQL (aliased as a in the main SQL) and create a testcase where it uses the function, versus a PL/SQL bind variable with the same data type and value as that returned by the function. Examine and compare the execution plans.
    Increase complexity (if no error) and repeat. Until the error is isolated.
    The 1st step in any troubleshooting, is IDENTIFYING the problem. Without knowing what the problem is, how can one fix it?

  • SQL Loader : Trim and Decode functions help please

    Hi,
    I have to load data from a flat file, for some columns i need to use TRIM and DECODE functions.It is a pipe delimited file.
    I get syntax errors (one is below) same error listed for TRIM.
    SQL*Loader-350: Syntax error at line xx.
    Expecting "," 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 anyone please help.
    Thanks
    Cherrish

    Hello Cherrish.
    The error you are receiving leads me to believe that at some point prior to the DECODE on the line for BUSINESS_ID, probably some line even before the FINAL_BILL_DATE line, there a syntactical error causing the quotes before the DECODE to actually terminate some other syntax. Without all of the lines that could actually contribute to this, including the header details, this is the best I can advise.
    Hope this helps,
    Luke
    Please mark the answer as helpful or answered if it is so. If not, provide additional details.
    Always try to provide create table and insert table statements to help the forum members help you better.

  • SQL*LOADER, the WHEN clause and WILDCARDS

    has anybody ever used wildcards in a WHEN clause in the SQL*LOADER control file?
    WHEN string_2_load = 'GOOD' , all 'good' rows load
    WHEN string_2_load = 'GO%', all rows fail the WHEN clause and end up in the discard file.
    thanks in advance - if i don't go crazy first
    burt

    I have also faced a similar problem like this. Try this control file
    LOAD DATA
    INFILE 'DATA.dat'
    BADFILE 'MLIMA.bad'
    INTO TABLE Brok_Gl_Interface
    APPEND
    WHEN record_type = '10'
    FIELDS TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    record_type CHAR ,
    currency CHAR ,
    entity CHAR ,
    cost_centre CHAR ,
    usd_account CHAR ,
    amount CHAR
    INTO TABLE Brok_Gl_Interface
    WHEN record_type = '99'
    FIELDS TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    record_type POSITION(1) CHAR ,
    record_count CHAR
    INTO TABLE Brok_Gl_Interface
    WHEN record_type = '00'
    FIELDS TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    record_type POSITION(1) CHAR,
    run_date CHAR,
    effective_date CHAR
    )Regards,
    Mohana

  • SQL Loader: using your own function

    Hi,
    Is it possible to include your own function in sql*loader? Would this be a correct syntax?
    LOAD DATA
    APPEND
    INTO TABLE MY_TABLE
    IDE "my_seq.nextval"
    CLIENT_NBR POSITION (1:10)          CHAR     
    CLIENT_TYP POSITION (11:12)     "MY_PACKAGE.MY_FUNCTION(:CLIENT_TYP)"
    )So the value of the data ( position 11:12) needs te be processed first by the function. The result of the function needs to be stored in the CLIENT_TYP column.
    Thank you
    Message was edited by:
    Ratjeuh

    still yes/yes after the edit?Yes :)

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

  • 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

  • Shockwave doesn't want to install through IE8 on XP

    Flash installed and works fine, but Shockwave doesn't on the same machine inside IE8. When I run Firefox on the same machine, both Shockwave and Flash work just fine. When I click on the "Agree and Install Now" button on http://get.adobe.com/shockwav

  • Libboost_python.so has tons of undefined symbols

    I've been trying to get Luxrender to work with Blender 2.63. The pylux.so module never loaded for some reason, so I traced the problem back to the libboost_python.so file and it seems to be throwing a ton of undefined symbol errors, all of them menti

  • Unable to Open adobe reader Portfolios due to flash not being installed

    Flash : 12.0 Adobe Reader: 11.05 OS: Windows 8.1 Browser: IE 11 Hi, when launching a PDF that is classed as a portfolio I get the below error which appears to require flash to be installed. two things im sort of observing: due to being on windows 8.1

  • Help with inline form

    answered

  • How can I turn off blocking "check out" on a secure server?

    Certain websites "Check Out" portions are blocked. Warning says " OCSP response is not yet valid (contains a date in the future) Error code: sec_error_ocsp_future_response. Authorization of received data could not be verified." What does this mean an