Extracting Multiple Logical Records through sql loader

Hello gurus,
I have few questions regarding the sql loader. I m totally new to this i have never used, this is the first time i m using
1.
How do i find the position number of the charcter or a number ? do i need to physically count the position ? is ther any specific way of counting or use textpad to do that ?
I know it sounds like silly question... but i wanted to know if there is any better way of doing it
2.
example data
1119 Smith      1120 Yvonne
1121 Albert     1130 Thomas
The following control file extracts the logical records:
INTO TABLE emp
     (empno POSITION(1:4)  INTEGER EXTERNAL,
      ename POSITION(6:15) CHAR)
INTO TABLE emp
     (empno POSITION(17:20) INTEGER EXTERNAL,
      ename POSITION(21:30) CHAR)---
2. Can you please expalin me what does the "null if deptno = blanks " ?
deptno POSITION(1:2)  INTEGER EXTERNAL(2)
              NULLIF deptno=BLANKS,I really appriciate it ~
Thanks

Hi,
The NULLIF means load blanks as NULL
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#sthref1129
Not sure I understand your first question. You must of course know the format of the file, TextPad could be an ok tool for determining that format for a fixed column width file.
Regards
Peter

Similar Messages

  • Is this possible through sql loader

    hi grus,
    i want to load a data through sql loader but the problem is, data file contains some numeric values and after each numeric value there is sign character,
    for example
    position 1 to 9 = 12345678- (in case of negative)
    or
    position 1 to 9 = 12345678% (% represents blank space in case of positive)
    is there any way to load this numeric value into one field, where the sign follow the numeric value?
    Thanks

    Hi Jim/Jenis
    Just want to know why the below statement dosn't work.
    when i used "MI" format then all the records which trailing blank rejected by the loader only trailing "-" loaded.
    CURR_MON_OPEN_BAL      position(0045:0053) "to_number(:CURR_MON_OPEN_BAL, '99999999MI')"
    then i use the following trick and works fine.
    CURR_MON_OPEN_BAL      position(0045:0053) "to_number(rpad(:CURR_MON_OPEN_BAL,9,'+', '99999999S')"
    Could you guys explain why the MI format doesn't work in my case?

  • Check data before loading through SQL *Loader

    Hi all,
    I have a temp table which is loaded through SQL*Loader.This table is used by a procedure for inserting data into another table.
    I get error of 0RA-01722 frequently during procdures execution.
    I have decided to check for the error data through the control file itself.
    I have few doubts about SQL Loader.
    Will a record containing character data for column declared as INTEGER EXTERNAL in ctrl file get discarded?
    Does declaring column as INTERGER EXTERNAL take care of NULL values?
    Does a whole record gets discarded if one of the column data is misplaced in the record in input file?
    Control File is of following format:
    LOAD DATA
    APPEND INTO TABLE Temp
    FIELDS TERMINATED BY "|" optionally enclosed by "'"
    trailing nullcols
    FILEDATE DATE 'DD/MM/YYYY',
    ACC_NUM INTEGER EXTERNAL,
    REC_TYPE ,
    LOGO , (Data:Numeric Declared:VARCHAR)
    CARD_NUM INTEGER EXTERNAL,
    ACTION_DATE DATE 'DD/MM/YYYY',
    EFFECTIVE_DATE DATE 'DD/MM/YYYY',
    ACTION_AMOUNT , (Data:Numeric Declared:NUMBER)
    ACTION_STORE , (Data:Numeric Declared:VARCHAR)
    ACTION_AUTH_NUM ,
    ACTION_SKU_NUM ,
    ACTION_CASE_NUM )
    What changes do I need to make in this file regarding above questions?

    Is there any online document for this?<br>
    Here it is

  • Importing oracle.sql.BLOB through SQL Loader

    Hello,
    Currently the system we have creates .sql files and executes them. This takes a long time, so we're attempting to change to using SQL Loader. The one problem I'm having that I can't seem to fix is finding out how to imitate the behavior of this SQL statement through SQL Loader:
    INSERT INTO KRSB_QRTZ_BLOB_TRIGGERS (BLOB_DATA,TRIGGER_GROUP,TRIGGER_NAME)
    VALUES (oracle.sql.BLOB@515263,'KCB-Delivery','PeriodicMessageProcessingTrigger')
    I tried creating a lobfile and placing the text oracle.sql.BLOB@515263 within it this way
    INTO TABLE KRSB_QRTZ_BLOB_TRIGGERS
    WHEN tablename = 'KRSB_QRTZ_BLOB_TRIGGERS'
    FIELDS TERMINATED BY ',' ENCLOSED BY '##'
    TRAILING NULLCOLS
    tablename FILLER POSITION(1),
    TRIGGER_NAME CHAR(80),
    TRIGGER_GROUP CHAR(80),
    ext_fname FILLER,
    BLOB_DATA LOBFILE(ext_fname) TERMINATED BY EOF
    However, as expected, it merely loaded the text "oracle.sql.BLOB@515263" into the database. So does anyone have any ideas of how to imitate that insert statement through SQL Loader? The only information I have available is the string "oracle.sql.BLOB@515263", no other files or anything to aid with actually getting the binary data.
    When the .sql file is run with that insert statement in it, a 1.2kb BLOB is inserted into the database versus a 22 byte BLOB that contains nothing useful when done through SQL Loader.
    Alex

    My preference is DBMS_LOB.LOADFROMFILE
    http://www.morganslibrary.org/reference/dbms_lob.html
    did you try it?

  • Defaulting org id value into a table through SQL Loader program

    Hi ,
    We have a requirement that we need to load some data from flat file to a table.we are using sql loader to do that. so far no problem but now the requirement is that we need to populate the org id from which we are running the program.
    I tried fnd_profile.value('ORG_ID') and it is populating site level org id.
    Coudl any one please help me how to default org id or request id into a table through sql loader program.
    Thanks,
    Y

    user12001627 wrote:
    Hi Srini,
    Thanks for looking into this!!
    We are on EBS 11.5.10 and OS is solaris.
    I tried fnd_profile,fnd_global but no luck.
    Here is the control file which we are using to load data.
    load data
    infile *
    replace into table XXXX_YYYY_STAG
    trailing nullcols
    (line POSITION(1:2000)
    I would like to populate org id when I load the data from file.unfortunately there is no identifier in the file that says for which org id the data is in the file.Only the way to identify the file org is based on file name
    Where do you want to populate the ORG_ID ? There is no column for it in your stage table above
    Is there way we can pass through concurrent program parameters?
    Thanks
    YHTH
    Srini

  • Error while executing Multiple Stored Procedure through .sql file

    Hi Guru's.
    I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
    I have one test.sql file with Stored Procedure is like,
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton1');
    END skeleton1;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton2');
    END skeleton2;
    Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
    I am opening test.sql file from SQL PLUS,
    SQL>
    1 CREATE OR REPLACE PROCEDURE skeleton1
    2 AS
    3 BEGIN
    4 DBMS_Output.Put_Line('skeleton1');
    5 END skeleton1;
    6 /
    7 CREATE OR REPLACE PROCEDURE skeleton2
    8 AS
    9 BEGIN
    10 DBMS_Output.Put_Line('skeleton2');
    11* END skeleton2;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> show errors;
    Errors for PROCEDURE SKELETON1:
    LINE/COL ERROR
    6/1 PLS-00103: Encountered the symbol "/"
    SQL>
    Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
    Regards,
    Shatrughan

    Hi,
    Try this
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton1');
    END ;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton2');
    END;
    /Save the file and call it.
    Regards,
    Bhushan

  • Need help, Trouble in uploading records using sql loader in Forms 6i

    Hi,
    I am trying to develop a screen for uploading records to a table by using a ctl file, batch file and sql loader.
    Env: Forms 6i, Oracle 8
    Table to be updated is: shy_upload_table
    My TSN entry looks similar to this,
    TEST_AXA.CNB.COM =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 11.23.11.123)(PORT = 1234))
    (CONNECT_DATA =
    (SID = axdabc)
    My intention is whenever i press the upload_button, I should truncate the table and upload it with the contents of the file.
    In the when-button-pressed event of the upload_button I have the following code. always I am able to truncate the table but am not able to upload it with the contents of the file. Can any of you help me fix this problem ?
    declare
         var_control varchar2(256);
         VAR_DATA VARCHAR2(256);
         VAR_OUTPUT VARCHAR2(500);
         var_filename varchar2(256);
         str varchar2(50);
         cnt number;
    begin
         FORMS_DDL('TRUNCATE TABLE shy_upload_table ');
         select count(*) into cnt from shy_upload_table;
         message('count '||cnt);
         MESSAGE('');
    If NOT form_success Then
         MESSAGE('Upload Failed');
         MESSAGE('Upload Failed');           
    else
         set_item_property('DISPLAY_PB',enabled,property_true);
    --when ever i run, i am able to see the display_pb enabled. it means form_success is true.
    end if;
         var_filename := :txt_filename;
    --I have tried with each of the below option,
    --sqlldr userid/[email protected] control=F:\ERP\file_upload.ctl
    --sqlldr userid/password@axdabc control=F:\ERP\file_upload.ctl
    --sqlldr userid/password@TEST_AXA.CNB.COM control=F:\ERP\file_upload.ctl
         VAR_DATA :='data=' || var_filename ;
         VAR_OUTPUT := var_control|| ' ' ||VAR_DATA;
         host('F:\a.bat');
    end;
    batch file contents...
    # I have tried with each of the below options
    sqlldr userid/[email protected] control=F:\ERP\file_upload.ctl data=F:\ERP\sample.txt log=F:\ERP\x.log bad=F:\ERP\x.bad
    #sqlldr userid/password@axdabc control=F:\ERP\file_upload.ctl data=F:\ERP\sample.txt log=F:\ERP\x.log bad=F:\ERP\x.bad
    #sqlldr userid/password@TEST_AXA.CNB.COM control=F:\ERP\file_upload.ctl data=F:\ERP\sample.txt log=F:\ERP\x.log bad=F:\ERP\x.bad
    pause
    Thanks
    vish

    Hi Francois,
    Thanks for responding, I am not very sure of what you want me to try out.
    When I double click the batch file containing the below, the record gets inserted in the table. Only when using my form and trying to upload, it fails to insert the record.
    batch file contents...
    #sqlldr userid/password@TEST_AXA.CNB.COM control=F:\ERP\file_upload.ctl data=F:\ERP\sample.txt log=F:\ERP\x.log bad=F:\ERP\x.bad
    pause
    Thanks
    Vish

  • Associating a header record to its detail record in SQL Loader

    I've a SQL loader script that loads data into 2 separate tables, one table containing header and one having details. Once the load is done there is no way to find out which item is associated to its header.
    Is there a way to associate a header record to its corresponding detail level?
    Edited by: 934858 on May 16, 2012 4:49 PM

    The load script is loading into 2 separate tables as below.
    load data
    append
    into table post1.thead
    when (1:5) = 'thead'
    TRAILING NULLCOLS
    (file_type POSITION(1:5) CHAR,
    file_line POSITION(6:15) INTEGER EXTERNAL,
    business_date POSITION(16:23) DATE "YYYYMMDD",
    load data
    append
    into table post1.tdetl
    trailing nullcols
    The data in the input file is as shown below...
    THEAD0000000002201109142011091400000000000002091 1 0 -1
    TTAIL0000000003000000
    THEAD0000000012201109142011091400000000000002091 1 0 -1 20110914-1
    TDETL0000000013CMPSPL1004 0 000000010000P0000000000000019990000000000000000200000
    TTAIL0000000014000001
    THEAD0000000021201109142011091400000000000002091 1 0 -1
    TDETL0000000022EMPDSC1005 0 000
    TDETL0000000023SCOUP 1006 0 973452 000

  • Load two input file into One Target table through SQL LOADER

    Hi Expert,
    I have 2 .cvs files.
    1st file having cols as account_no & first name
    2nd file having cols as account_no & last name
    There is a table called temp has 3 cols accounts_number first name & last name
    accounts number in both files are same
    Now I wann upload these 2 files in to table temp
    how do I do that
    Pls suggest
    Thx
    Umesh Goel

    UG wrote:
    I dont want truncate my table bcoz account no and first name from first file and last name from second file.
    so pls suggest something else....Hang on, I'll go find you some glasses. I think you're having trouble reading.
    First file : Control file truncates and loads data
    Second file : Control file does not truncate and loads data
    2 Calls to SQL*Loader
    Is that a little clearer?
    Are you saying there is a relationship between the data in the two files?
    How do you know which last name relates to which first name in the first file? Is there a reference key between the records on the two files?
    Perhaps you'd better show us an example of the contents of the files so we can see what you are trying to do.

  • How to skip footer record in SQL*Loader input file

    I have am using SQL*Loader in a batch import process.
    The input files to SQL*Loader have a header record and footer record - always the 1st and last records in the file.
    I need SQL*Loader to ignore these two records in every file when performing the import. I can easily ignore the header by using the SKIP function.
    Does anybody know how to ignore the last record (footer) in an input file??
    I do not want to physically pre-strip the footer since the business want all data files to have the header and footer records.

    Thanks - how do I use the when clause to specify the last line of the input file?
    I am presuming it requires me to have a unique identifier at a given position on that last line. If I don't have such an identifier can I still use your solution?
    Cheers Why not putting an idetifier at the end of your input file: echo "This_is_the_End" >> input_file ?

  • Multiple CONTINUEIF statements in SQL Loader

    Anyone know how to do this?
    Yes. I have read the Oracle documentation on SQL Loader and use of the CONTINUEIF statement. It doesn't state what the syntax is when setting CONTINUEIF for different columns, some that may not be contiguous.
    I want to say something like
    CONTINUEIF THIS (10)='-' AND THIS (11)='/'
    I've tried various permutations of this syntax and a few others. Nothing I've tried works.
    I can get CONTINUEIF to work if I only use one instance(column) specification.
    Thank You in advance for any help.

    You can only use a single CONTINUEIF clause in a SQL*Loader command file. If the characters are contiguous, then you can use CONTINUEIF THIS (10-11)='-/'

  • Loading through sql* loader

    Hi,
    I want to load xml file data using sql*loader into Oracle.
    Kindly advice what could be the pros & cons for this.
    Is there any online document for this?
    Thanks
    Deepak

    Is there any online document for this?<br>
    Here it is

  • Loading datas through sql loader

    dear all,
    I have a table with a date column where I have specified the datatype as date, and when am trying to load datas sqlloader :
    Record 51: Rejected - Error on table SYSTEM.PROJECT, column D_DATE.
    ORA-01843: not a valid month
    select sysdate from dual
    11/10/2007 1:53:55 PM -- which is of the format mm/dd/2007
    am loading the datas in the same format even then, am getting the above error..
    Here it is..
    control file
    LOAD DATA
    infile *
    INSERT
    INTO TABLE system.project
    FIELDS TERMINATED BY ','
    (SERIAL,D_DATE date "DD-Mon-YY",PLATE_NO,IN_KM,OUT_KM,LOCATION,DESTINATION,LITERS,VEHICLE_TYPE,Division,REMARKS)
    begindata
    table structure :
    SQL> desc project1
    Name Null? Type
    SERIAL NUMBER(10)
    D_DATE DATE
    PLATE_NO VARCHAR2(20)
    IN_KM VARCHAR2(20)
    OUT_KM VARCHAR2(20)
    LOCATION VARCHAR2(20)
    DESTINATION VARCHAR2(40)
    LITERS NUMBER(10)
    VEHICLE_TYPE VARCHAR2(40)
    DIVISION VARCHAR2(40)
    REMARKS VARCHAR2(40)
    Please guide

    Thanks sam.. I changed the control file like :
    LOAD DATA
    infile *
    append
    INTO TABLE system.project
    FIELDS TERMINATED BY ','
    (SERIAL,D_DATE date "DD-Mon-YY",REMARKS)
    begindata
    and now it is working fine..
    Thanks
    Yusuf

  • Unable to load clob data through sql loader

    Hi Experts ,
    My ctl file is :
    LOAD DATA infile '$di_top/conversion/devtrack_notes.csv'
    truncate into table xxdi_proj
    fields terminated by ','
    optionally enclosed by '"'
    trailing nullcols (bugid,note *clob*)
    {code}
    The problem is note column is a clob and one of the
    values has line breaks like this :
    {code}
    Hi Sir,
    Would you please inform when the reports are scheduled for automatic process?
    Maria will stop his process to avoid duplication.
    Please inform asap
    With Regards ,
    Ronaldinho
    {code}
    When the data gets loaded ,
    The first column gets the sentence 'Would you please inform.....' i.e . the data of second columns gets loaded into first column as nulls are recognized as end delimiter.
    How to overcome this problem?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Pl post your exact OS and database versions, along with your complete sqlldr command, the table description and a sample of your input csv file.
    HTH
    Srini

  • Can we handle multiple fields delimiter in sql*loader

    Hi,
    Users wants to load the data from each of their individual system. But problem is when they save the csv file, due to their sytem setup some files gettng saved with pipe (|) seperated and on some system it is saved with comma (,) sepearted fields.
    Can we handle both these field seperator in control file?
    Please suggest
    Thanks,
    Rahul

    Rahul,
    I recommned you should use "|" as "," can be embedded in a text string. I guess you can pass a directive to use to deliver "|" delimited file :). If you want to handle both then you might have to write a shell script or bat to pass delimiter as an argument which will edit and replace your control file.
    Regards

Maybe you are looking for

  • Income tax amount adjustment

    Hi Experts, I am getting Income tax issue  as per SAP  for one employee income tax have to deduct 7450 rupees for the month of April. But my client has been deducted 9000 rupees for the month of April and paid salaries through legacy. Already I maint

  • Photobooth Error!! - PLEASE HELP!!!

    So I just went out to buy a webcam for my Mac Mini and I bought this Advent 1.3mp Interchangeable Web cam, according to the box. I plugged it in, opened up iChat it works like a charm, the same can be said for Skype. Though, when I opened up Photo bo

  • EDirectory question about OES2SP3 to OES11SP1 upgrade

    My apologies if this is not the correct place to ask this question but I decided to ask here becuase my question involved OES. We are going to perform an offline upgrade to OES 11 SP1 of an OES2SP3 server that hasn't been patched in one year. Novell

  • CS6 ask for administrator permissions for use after new installation - Win XP SP3

    Installed and verified CS6 successfully as Administrator. Works perfectly as Administrator. But as a user impossible. The installation & activation was done as Administrator. But when the user log-in and attempt to open the software - eg InDesign - e

  • Photoshop Video Frames to Layers Cripples Premiere

    Hey folks, I've been using Premiere and AE with dynamic link for some time now to make my videos. Up until this past week, the playback of Linked Comps from AE in Premiere was buttery smooth. I could playback on my Mac 2013 Retina (With CS6) at full