Sql-ldr

Hi Experts,
I want to load the data from flat file to database tables with help of sql ldr .. the scenario is i want to load the flat file "name" (no need extention, name of the file only need to be loaded in to the table columns) in to one of the table column, can any one please help me how to load the file name in to tables, how to manually insert the singale file name to table column, please guide me with detail?
Thanks,

Hi,
As I said earlier, you have to maintain the list of filename's "itemdescr" in different temp file and load it an and when required table instead of checking for round robin functionality. If you are looking forward that oracle sqlldr can able to access the filename as one of the parameter then - it might not possible AFAIK.
else perform the direct insert on the table from sqlclient.
- Pavan Kumar N

Similar Messages

  • Summary SQL*LDR log file

    Hi,
    I need to get only a summary log file that show me records by error. for example if the log file has 5000 error for datatype and 300 for PK violation and 2000 for not null value, the problem that the log will show me this error row by row. can I get it summary like this
    -5000 rows rejected due to error for datatype
    -300 rows rejected due to PK violation
    -2000 rows rejected due to not null value
    Database: 9i
    O/S: Windows 2000 Server

    eng. Habeeli wrote:
    schavali wrote:
    Pl see your duplicate post here - big SQL*LDR log file
    Pl post what you have found in the documentation so far. AFAIK, there is no way to get a summary log file.
    Sriniits not duplicate ,I change to this form that specialized in sql loadre.
    I don't found any thing about summary log in the documnetPl post a link to the document you read. Did you see my comment above ?
    HTH
    Srini

  • ODI SQL LDR issue

    Hi Guys,
    I am trying to load one csv file using sqlldr LKM and facing issue at Call Sqlldr step
    Error Message is:
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (most recent call last):
    File "<string>", line 22, in <module>
    Load Error: See Y:/BTLB_PLANS Product Codes ( A CODE LIST).log for details
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2473)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:561)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: Traceback (most recent call last):
    File "<string>", line 22, in <module>
    Load Error: See Y:/BTLB_PLANS Product Codes ( A CODE LIST).log for details
         at org.python.core.PyException.fillInStackTrace(PyException.java:70)
         at java.lang.Throwable.<init>(Throwable.java:181)
         at java.lang.Exception.<init>(Exception.java:29)
         at java.lang.RuntimeException.<init>(RuntimeException.java:32)
         at org.python.core.PyException.<init>(PyException.java:46)
         at org.python.core.PyException.doRaise(PyException.java:219)
         at org.python.core.Py.makeException(Py.java:1166)
         at org.python.core.Py.makeException(Py.java:1170)
         at org.python.pycode._pyx0.f$0(<string>:59)
         at org.python.pycode._pyx0.call_function(<string>)
         at org.python.core.PyTableCode.call(PyTableCode.java:165)
         at org.python.core.PyCode.call(PyCode.java:18)
         at org.python.core.Py.runCode(Py.java:1204)
         at org.python.core.Py.exec(Py.java:1248)
         at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:172)
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)
         at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2472)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:47)
         at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         ... 1 more
    and Code:
    import java.lang.String
    import java.lang.Runtime as Runtime
    from jarray import array
    import java.io.File
    import os
    import re
    ctlfile = r"""Y:/BTLB_PLANS Product Codes ( A CODE LIST).ctl"""
    logfile = r"""Y:/BTLB_PLANS Product Codes ( A CODE LIST).log"""
    outfile = r"""Y:/BTLB_PLANS Product Codes ( A CODE LIST).out"""
    oracle_sid=''
    if len('UREPDEV')>0: oracle_sid = '@'+'UREPDEV'
    loadcmd = r"""sqlldr 'REDW_DA_OWNER/<@=snpRef.getInfo("DEST_PASS") @>%s' control='%s' log='%s' > "%s" """ % (oracle_sid,ctlfile, logfile, outfile)
    rc = os.system(loadcmd)
    if rc <> 0 and rc <> 2:
         raise "Load Error", "See %s for details" % logfile
    # Init Vars
    nbIns = 0
    nbRej = 0
    nbNull = 0
    strprt = ""
    maxAllowedError = r"""0"""
    c = 0
    flag = 0
    # Open log file
    f = open(logfile, "r")
    try:
         lines = f.readlines()
         for line in lines:
              if line.rstrip().upper().endswith(r"""REDW_DA_OWNER.TC$_0TEST:""".upper()):
                   flag = 1
                   c = 0
              if flag == 1:
                   if c > 0 and c <= 4:
                        if c == 1 :
                             nbIns = int(re.findall("\d+", line)[0])
                        elif c == 2:
                             nbRej = int(re.findall("\d+", line)[0])
                        elif c == 4:
                             nbNull = int(re.findall("\d+", line)[0])
                             break
              c+=1
         strprt = "\n\tIns:\t%s\n\tReject:\t%s\n\tNullField:\t%s" % (nbIns, nbRej, nbNull)
    finally:
         f.close()
    # if some rows has been rejected due to invalide data, check KM option LOA_ERRORS
    if rc == 2:
         if nbRej > int(maxAllowedError):
              raise strprt
              break
    I am using LKM File to Oracle(SQLLDR)
    Thanks in advance

    error is saying:
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (most recent call last):
    File "<string>", line 22, in <module>
    Load Error: See Y:/<file_name>.log for details
    and no log file is created for that.
    Few more things to add.
    We have 2 different boxes. 1. ODI box (different server address)
    2. DB box (different server address)
    and Sql developer is installed on DB box. I am able to use SQLLoader utility through SQL Developer.
    But when I am using ODI to use sql ldr through LKM SQL to Oracle (Sqlldr).
    It is getting failed at 6th step i.e. Call sqlldr.
    Error is : org.apache.bsf.BSFException: exception from Jython:
    Traceback (most recent call last):
    File "<string>", line 22, in <module>
    Load Error: See<file_name>.log for details
    but to my surprise all files were created at the folder except .log file.
    Can anybody help me to solve this issue.
    This is very urgent.
    Is this because sqlldr is not accessible to ODI then how .ctl & .bad files are created.
    I will really appreciate your help. it is bit urgent to solve this issue.
    Edited by: 965549 on Oct 28, 2012 10:36 AM

  • Sql ldr help

    Hi All,
    I'm having a problem with the sql ldr ...
    SQL> sqlldr control=xyz.ctl
    SP2-0734: unknown command beginning "sqlldr con..." - rest of line ignored.
    SQL> sqlldr hr/hr control=c:\users\nalla\desktop\xyz.ctl
    SP2-0734: unknown command beginning "sqlldr hr/..." - rest of line ignored.
    SQL>
    I have my control file and data file all good.
    Please help me
    Thanks!

    I don't think you need this reserved keyword userid
    userid=hr/hr
    Just sqlldr hr/hr@dbname control =abcd.ctl
    Nalla,
    OAD DATA
    INFILE 'C:\Documents and Settings\...............\abc.csv'
    BADFILE 'C:\Documents and Settings\...............\abc.bad'
    DISCARDFILE 'C:\Documents and Settings\\...............\abc.dis'
    APPEND INTO TABLE xyz REPLACE
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
    a     CHAR,
         b     CHAR,
         c     CHAR,
         d     CHAR
    Please advise.

  • SQL LDR LKM generating incorrect CTL file

    Hi,
    The LKM for SQL LDR is generating incorrect CTL file for a fixed length data file. Due to this the ODI is erring out.
    Here are the contents of the CTL file:
    SnpsOutFile "-File=//Myserver/myfile.ctl"
    OPTIONS (
         SKIP=0,
         ERRORS=0,
         DIRECT=TRUE
    LOAD DATA
    INFILE "//Myserver/myfile.RDY"
    BADFILE "//Myserver/myfile.bad"
    DISCARDFILE "//Myserver/myfile.dsc"
    DISCARDMAX 1
    INTO TABLE ORA_SCHEMA.C$_0RAW_TABLE
         C1_CHAR9     POSITION(:),
         C2_CHAR2     POSITION(:),
         C3_CHAR6     POSITION(:),
         C4_CODE          POSITION(:),
         C5_RAWG_CODE     POSITION(:),
         C6_E_NUMBER     POSITION(:),
         C7_T_NUMBER     POSITION(:),
         C8_C_COLOR     POSITION(:),
         C9_D_COLOR     POSITION(:),
         C10_R_CODE     POSITION(:)
    Why is "POSITION(:)" not getting the numbers before and after ":" ?
    I reverse engineered this file and have the correct values for "Physical Length" and "Logical Length"
    TIA,
    Ankit

    Hi Ankit,
    I think the column transformation mappings are set on the Source (radio button) in the Integration Interface Mapping window.
    Change the column transformation mappings to be executed on STAGE .
    It should resolve this issue.
    Thanks,
    Sutirtha

  • ODI 10g R2 LKM File to Oracle (sql*ldr)  ctl file

    Hi,
    ODI release 10.1.3.4
    I need to load a file into an oracle db. For big file I use the LKM file to oracle (sql loader). It is a delimited file with ' " ' enclosed text. I give in the datasotre all parameters record separator, field separator, text delimiter, decimal separator. Despite in the control file for sql*ldr it miss the line [optionnaly enclosed '"' ] so in my db it is loading "nn" instead of nn ...
    Do someone know this issue ?!
    Best regards,
    BL

    It would be best to you look in to the LKM code to see if its even there "optionally enclosed by"
    This is an old version of ODI and its quite possible that the support for this clause was not added to the step that builds the ctl file.
    If its not there, then you can add it your self.

  • How to Use Sequence created in Oracle Database in SQL Ldr Control file

    Hi,
    I created a sequence in oracle database. How will use the sequence in SQL loader Control file.
    Thanks in advance

    Hi,
    You might get a good response to your post in the forum dedicated to data movement , including SQL*Loader . You can find it here Export/Import/SQL Loader & External Tables
    Regards,

  • Big SQL*LDR log file

    Hi,
    I need to get only a summary log file that show me records by error. for example if the log file has 5000 error for datatype and 300 for PK violation and 2000 for not null value, the problem that the log will show me this error row by row. can I get it summary like this
    -5000 rows rejected due to error for datatype
    -300 rows rejected due to PK violation
    -2000 rows rejected due to not null value
    can u give me hand with this?

    Pl post details of OS and database versions. There is a dedicated SQL*Loader forum at Export/Import/SQL Loader & External Tables
    Have you reviewed the documentation for your database version at http://docs.oracle.com ? If so, what have you determined so far ?
    HTH
    Srini

  • Problem in Loading data for clob column using sql ldr

    Hi,
    I am having problem in loading data for tables having clob column.
    Could anyone help me in correcting the below script for ctrl file inorder to load the data which is in mentioned format.
    Any help really appreciated.
    Table Script
    Create table samp
    no number,
    col1 clob,
    col2 clob
    Ctrl File
    options (skip =1)
    load data
    infile 'c:\1.csv'
    Replace into table samp
    fields terminated by ","
    trailing nullcols
    no,
    col1 Char(100000000) ,
    col2 Char(100000000) enclosed by '"' and '"'
    Data File(1.csv)
    1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
    2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"
    Error Encountered
    ORA-01461: can bind a LONG value only for insert into a LONG column
    Table sampThanks in advance

    I can't reproduce it on my 10.2.0.4.0. CTL file:
    load data
    INFILE *
    Replace into table samp
    fields terminated by ","
    trailing nullcols
    no,
    col1 Char(100000000) ,
    col2 Char(100000000) enclosed by '"' and '"'
    BEGINDATA
    1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
    2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"Loading:
    SQL> Create table samp
      2  (
      3  no number,
      4  col1 clob,
      5  col2 clob
      6  );
    Table created.
    SQL> host sqlldr scott/tiger control=c:\temp\samp.ctl log=c:\temp\samp.log
    SQL> select * from samp
      2  /
            NO
    COL1
    COL2
             1
    asdf
    assasadsdsdsd"sfasdfadf"sdsdsa,ssfsf
             2
    sfjass
    dksadk,kd,ss"dfdfjkdjfdk"sasfjaslaljs
            NO
    COL1
    COL2
    SQL> SY.

  • SQL*LDR - reading num of chars instead of a line

    Is there a way we can make LDR to read number of characters instead of a line at a time from the input data file?

    Lets we have one big line with X,Y,Z information in the line and its repeated without a new line in between them. If X=1,Y=1,Z=1 in lengths then something like following needs to be read from the input datafile:
    UACUBDUMNUFT....
    Now I need to read column X, column Y and column Z and please mind that everything is in one line.
    Thanks

  • Sql Ldr control file

    Hi, Any one of you suggest me to take a data file and enter the result in
    to different tables by using control file.
    We have created 3 diferent empty tables of same structure and we have
    to load data based on DEPTNO to the respective tables.
    the code which I have provided is inserting in to the first table but
    not in to the other 2
    I had written a code which is here Could you please help me
    out...........as early as possible
    load data
    infile 'c:\mlt.dat'
    truncate
    into table emp_10
    when deptno="10"
    fields terminated by ','
    ( empno
    ,deptno
    ,dname
    ,ename
    ,sal
    ,loc)
    into table emp_20
    when deptno="20"
    fields terminated by ','
    ( empno
    ,deptno
    ,dname
    ,ename
    ,sal
    ,loc)
    into table emp_30
    when deptno="30"
    fields terminated by ','
    ( empno
    ,deptno
    ,dname
    ,ename
    ,sal
    ,loc)

    why would you want to create different tables for each department. This will be horror for any application accessing the data.

  • SQL LDR Control file date format

    Hi All
    I need to Insert date with time using sqlldr.
    In my data file am getting date value as 20110103 10:27:44.
    In control file am doing like this
    creation_date "decode(:creation_date, 'null', null, 0,null,to_date(:creation_date, 'YYYYMMDD HH24:MI:SS'))
    This is inserting only date Ex: 1/3/2011 but I need to insert date with time ex:1/3/2011 10:27:44 AM
    Please advice
    Thanks
    Raj
    Edited by: user632682 on Feb 15, 2011 10:37 AM

    Raj,
    Doesn't make any sense to have date as 0, so either you should use null or sysdate. You can write a function and use it in your sqlldr control file. This is just an example and you can write this anyway
    # sqlldr control file
    Creation_date DATE 'YYYYMMDD HH24.MI.SS'  "format_date(:creation_date)"
    CREATE OR REPLACE FUNCTION format_date(i_date in DATE)
    RETURN DATE
    IS
    BEGIN
    if (i_date is NULL or i_date = 0 ) then
    i_date := sysdate;
    end if;
    return i_date;
    END format_date;Regards

  • 10g sql ldr

    Hi everyone,
    Can I install sqlldr after a 10g client software is installed? The server is for datastage. ANY HELP WOULD BE APPRECIATED!!
    THANKS

    I am on an AIX server w/10g client installed. Does any1 know where I can find the software so i can download it database version is 10G R1. Once I download the softwware I will send thru winscp to the server and then unzip and then ./runInstaller. The reason y I am doing this is because who ever installed the client before did not download sqlldr. Will I have to patch the current ORACLE_HOME or can I just ./runinstaller then click custom and choose sqlldr? Please I have been stuggling w/this for a couple days now.
    Thanks
    Mohammed

  • Sql*ldr + *.dbf

    How to use sqlldr to load *.dbf files to oracle 9.x table?
    Solution for oracle 6.x not working with 9.x/

    sqlldr loads flat files of data, not database data files.
    If that doesn't answer your question, please respond with about 10X more clarity about what you need help with.
    Michael

  • SQL Loader Problem : how to skip column using sql ldr

    Hi,
    My problme is like this.
    In the data file i am getting some data and storing it in flat file format with ` as delimiter.
    For example:
    t1col1`t1col2`t1col3`t2col1`t2col2`t2col3`t2col4
    There are two tables here i.e t1 having 3 columns and t2 having 4 column values.
    But in the database i m having only 3 columns for t2 which corresponds to data of t2col3. Now in my control file can i use filler to skip this value in the datafile with the columnName mentioned.
    So my basic question is can i get rid of some column value which is there in the datafile and its position is not known when it will come but its name is known and its name is not present in the actual database. Can it be done using keyword "filler".
    Any help on this would be highly appreciated.
    Eagerly waiting for your reply.
    Regards,

    You will able to find good information about it in this document :
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96652.pdf
    Joel P�rez

Maybe you are looking for