Format input for Sql*Loader

I have a problem in formating an input file for Sql*Loader
The file has the following format:
1 Jeff
2 Kyle
3 Tom
1 Lisa
2 Bryan
3 Max
4 Rob
5 Steve
1 Richard
2 Mary
and so on
the file should look as follows to process with Sql*Loader:
1 Jeff 2 Kyle 3 Tom
1 Lisa 2 Bryan 3 Max 4 Rob 5 Steve
1 Richard 2 Mary
any suggestions?
Edited by: royce on Sep 18, 2008 2:08 AM

royce wrote:
I have a problem in formating an input file for Sql*Loader
The file has the following format:
1 Jeff
2 Kyle
3 Tom
1 Lisa
2 Bryan
3 Max
4 Rob
5 Steve
1 Richard
2 Mary
and so on
the file should look as follows to process with Sql*Loader:
1 Jeff 2 Kyle 3 Tom
1 Lisa 2 Bryan 3 Max 4 Rob 5 Steve
1 Richard 2 Mary
any suggestions?
Edited by: royce on Sep 18, 2008 2:08 AMActually, looking at your data again, you don't have a consistent format, so this makes it really difficult for something like SQL*Loader to process. If there were just e.g. 3 rows per record then that would be simple, but you are expecting SQL*Loader to look ahead to determine if there is more data or if it's reached the end of the record.
You would be better to load the data (external tables would probably make it quicker and easier as the data will come in the order as it is specified in the file, which would help as you have no group identifier against the sets of records) as it is and then use SQL to process them.
You haven't specified the resulting table that the data is loaded into. Is that just one single VARCHAR column with all the data concatenated or is it several columns (one for each name)?

Similar Messages

  • How to set default directory for SQL LOADER

    hi all,
    i wanted to know how can we setup a default directory for SQL LOADER if at all we can. i connot place my control and data files in local system and use them at command prompt. rather i wanted to know if we can set default directory that the loader can use. this requirement is basically to enable all the clients to upload the data placed on the server and use the loader utility.
    thanks in advance,
    Basavraj

    Ella,
    You don't say which version of SQL Developer you are using via Citrix, but just setting the SQLDEVELOPER_USER_DIR hasn't worked for a long time (see Re: SQLDEVELOPER_USER_DIR does not function anymore). Also, since version 1.5, the default for the user directory (now set via ide.user.dir as shown below) is under the user profile area (relative to %APPDATA%), which you should be able to write to, even on Citrix.
    Assuming that neither of those help, you will need to get whoever installed SQL Developer on the Citrix C: drive to modify the sqldeveloper.conf to have a line like, where the path exists for everyone who will be using the shared SQL Developer (assumes everyone has a H: drive):
    AddVMOption -Dide.user.dir=H:\sqldeveloperAn alternative (depending on how you start SQL Developer via Citrix), is to create your own shortcut to start SQL Developer with something like:
    sqldeveloper -J-Dide.user.dir="%SQLDEVELOPER_USER_DIR%"theFurryOne

  • Concatenate positions in control file for sql*loader utility.

    Is there a way to concatenate several character positions in a control file for sql*loader???
    example... field1 position(1:3) || position(5:7) ????
    I would rather not create any unnecessary temp tables for a straight load...

    How about...
    /code
    field1 position(1:7) char "substr(:field1, 1, 3) || substr(:field1, 5)"

  • Why no exclusive lock for conventional path loading for SQL*Loader?

    why no exclusive lock for conventional path loading for SQL*Loader?
    it use insert statement so it should use exclusive lock right?
    thanks

    ok, so only update statement would put a lock but not for insert statement?
    because I have seen a situation where a user update rows in a sesssion (without commit) prevent another user update the rows.
    thanks

  • Controller file for SQL Loader

    Guys,
    My data is coming in flat from some third party in the below format
    1,Stewart,"Current Address: Street-A, Flat-507,  London, UK
    Permanent Address: Street-B, Flat-201, London, UK"
    2,Patrick,"Current Address: Street-A, Flat-507,  Bangalore, India
    Permanent Address: Street-B, Flat-201, Delhi, India"
    I want to load the data in a custom table by using a SQL loader program which will use a controller program. This program needs to populate the table in below manner
    SEQ                                EMPLOYEE                                           ADDRESS INFORMATION
    1                                     Stewart                                                  Current Address: Street-A, Flat-507,  London, UK
                                                                                                        Permanent Address: Street-B, Flat-201, London, UK
    2                                     Patrick                                                  Current Address: Street-A, Flat-507,  Bangalore, India
                                                                                                        Permanent Address: Street-B, Flat-201, Delhi, India
    Could you guys please help me in writing the controller file to read the data from file and populate the table as described above. Thanks.
    -Sunil

    It is a little hard to tell exactly what your data file looks like and what you want your results to be, due to this forum mangling things a bit and adding extra lines and such.  In general you can either use CONTINUEIF or CONCATENATE.  I have demonstrated both below.  When using CONTINUEIF, it assumes each additional line begins with the word "Permanent".  When using CONCATENATE, it assumes each two lines constitutes one record.  I have also used REPLACE to add a line feed in front of "Permanent", after it is removed during continuation or concatenation.
    SCOTT@orcl12c> host type test.dat
    1,Stewart,"Current Address: Street-A, Flat-507,  London, UK
    Permanent Address: Street-B, Flat-201, London, UK"
    2,Patrick,"Current Address: Street-A, Flat-507,  Bangalore, India
    Permanent Address: Street-B, Flat-201, Delhi, India"
    SCOTT@orcl12c> host type test.ctl
    load data
    infile test.dat
    continueif next preserve (1:9) = 'Permanent'
    into table test_tab
    fields terminated by ','
    optionally enclosed by '"'
    trailing nullcols
    (seq, employee,
    address_information "replace (:address_information, 'Permanent', CHR(10) || 'Permanent')")
    SCOTT@orcl12c> host type test2.ctl
    load data
    infile test.dat
    concatenate 2
    into table test_tab
    fields terminated by ','
    optionally enclosed by '"'
    trailing nullcols
    (seq, employee,
    address_information "replace (:address_information, 'Permanent', CHR(10) || 'Permanent')")
    SCOTT@orcl12c> create table test_tab
      2    (seq                    number,
      3     employee               varchar2(8),
      4     address_information    varchar2(200))
      5  /
    Table created.
    SCOTT@orcl12c> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 12.1.0.1.0 - Production on Mon Dec 16 13:11:40 2013
    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
    Path used:      Conventional
    Commit point reached - logical record count 1
    Commit point reached - logical record count 2
    Table TEST_TAB:
      2 Rows successfully loaded.
    Check the log file:
      test.log
    for more information about the load.
    SCOTT@orcl12c> column address_information format a60
    SCOTT@orcl12c> select * from test_tab
      2  /
           SEQ EMPLOYEE ADDRESS_INFORMATION
             1 Stewart  Current Address: Street-A, Flat-507,  London, UK
                        Permanent Address: Street-B, Flat-201, London, UK
             2 Patrick  Current Address: Street-A, Flat-507,  Bangalore, India
                        Permanent Address: Street-B, Flat-201, Delhi, India
    2 rows selected.
    SCOTT@orcl12c> truncate table test_tab
      2  /
    Table truncated.
    SCOTT@orcl12c> host sqlldr scott/tiger control=test2.ctl log=test2.log
    SQL*Loader: Release 12.1.0.1.0 - Production on Mon Dec 16 13:11:40 2013
    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
    Path used:      Conventional
    Commit point reached - logical record count 2
    Table TEST_TAB:
      2 Rows successfully loaded.
    Check the log file:
      test2.log
    for more information about the load.
    SCOTT@orcl12c> select * from test_tab
      2  /
           SEQ EMPLOYEE ADDRESS_INFORMATION
             1 Stewart  Current Address: Street-A, Flat-507,  London, UK
                        Permanent Address: Street-B, Flat-201, London, UK
             2 Patrick  Current Address: Street-A, Flat-507,  Bangalore, India
                        Permanent Address: Street-B, Flat-201, Delhi, India
    2 rows selected.

  • Utility to convert ASE  fmt files to ctl files for sql*loader

    Does anyone have a utility to convert bcp format files to oracle ctl files for use with sql*loader?

    Hi,
    The Oracle Migration Workbench will produce both BCP and the equivalent Oracle .ctl files for all tables in a database.
    Regards
    John

  • Script for sql*loader

    Hi All,
    I am loading the data from .csv format to table by using sql*loader.
    This sql*loader command was existed in one of the pl/sql Procedure. this procedure will first create a table and then it will get the data by using sql*loader command,then one procedure will run.
    to run this script we are manually loading the data from excel by using sql*laoder by running the .ctl command from Command prompt.. instead of doing manually this process is there any other way to do it automatically.
    if it is possible please let me know.
    here i am giving the script
    drop table emp;
    create table emp
    (eno number,
    ename  varchar2(20),
    job varchar2(20),
    sal number(4),
    doj date
    - here table created.then here by using below sql*loader command loading the data info emp table
    load data
    infile <file path>
    fields terminated by ','
    intto table emp
    (eno,
    ename,
    job,
    sal)by running this control file manually from command prompt loading the data.
    then there is a procedure which we need to to update the EMP table.
    for this whole thing we are just running the script except loading the data part.
    for this please let me know the automation part.
    Thanks.

    Hi,
    Create a shell Script(Unix) or Windows batch Job to automate the entire process. The script will like below
    1.Connect SQLPLUS with the Createtable.SQL file (The Createtable.sql will have the create table script)
    2.invoke sql loader with the control file
    3.then again connect SQLPLUS with the executeproc.sql file (the executeproc.sql will have the execute command to execute the stored procedure)
    by this way your entire process can be in one script and automate by scheduling it in unix or windows.
    Thanks,
    Vijay
    Edited by: Vijayaraghavan Krishnan on Nov 27, 2012 4:48 PM

  • Changing the File path for SQL Loader Recognition

    I am learning how to create a control file. The names.ctl file was placed in "Names" folder in my "C:\Windows" file.
    I get the following error when trying to run the script for sqlldr:
    Sql*Loader-500 Unable to open file.
    Sql*Loader-553 file not found
    Sql*Loader-System error: the system cannot find the specified file.
    The path on the folder in c:\Windows\names\names.ctl
    How do I make SQL Loader recognize it?

    Pl post details of OS and database versions. Have you tried this ?
    sqlldr CONTROL=c:\Windows\names\names.ctl ...HTH
    Srini

  • Control file for SQL*Loader

    Hello,
    I have the following file (2 line) which I want to intend in an oracle database with the SQL*Loader.
    tommy050+3423
    tom 070-0006
    The file consists of two lines and three columns.
    Column1 has always 5 digits and is a String. Additional empty digits will be filled with blanks. Here: “tommy” and “tom “
    Column2 has three digits and is a number. Here: “050” and “070”.
    Column 3 is also a number and consists of four digits. Additionally there is a fifth digit for the leading sign ("+" or "-"). Here: “+3423” and “-0006”.
    This file I want to import in my table “MyTab”.
    MyTab(
         thing          VARCHAR2(5)
         number     NUMBER(3)
         amount     NUMBER
    How would the control file for the SQL*Loader look like for this example?
    Regards
    Homer

    This is a start (untested)
        LOAD DATA
        INFILE 'sample.dat'
        BADFILE 'sample.bad'
        DISCARDFILE 'sample.dsc'
        APPEND
        INTO TABLE MyTab
          ( thing POSITION(1:5)  CHAR ,
           NUMBER    POSITION(6:8)  INTEGER,
           amount POSITION(9:12) INTEGER  )Can you have a column named number?

  • OWB 10gR2 : How to configure ctl and log locations for Sql*Loader mappings?

    Hi all,
    I'm using OWB 10gR2 to load data in tables with Sql*Loader mappings.
    In my project I have a datafile module and an Oracle module.
    When creating an sql*loader mapping in the oracle module, there is two properties for this mappings that I want to modify. The first is Control File Location and the second is Log File Location. Values for those properties are equal to the data file module location. When trying to change those values I can only chose "Use module configuration location".
    Somebody knows how to configure those properties with different locations as the one of the flat file module?
    What I want to do is to store the data file in one directory, and control file and log file in other directories.
    Thank you for your help.
    Bernard

    Hi,
    You're right, my problem is that the dropdown only show the location associated with the flat file location even if I have other file locations created in the design repository.
    The good news is that I have found the solution to solve the problem :
    1) Edit the file module and in tab "Data locations", add the locations you want to use for control file and log file.
    2) Open configuration window of the mapping and then the dropdown for properties Control File Location and Log File Location show new locations
    I have tested my mapping after changing those properties and it's working.
    Bernard

  • Looking for SQL*Loader sample file

    Hi all,
    I'm looking for a sample SQL*Loader file that I could use to populate the Bank Statement Interface in Cash Management (Receivables Lockbox Receipts) - specifically CE_STATEMENT_HEADERS_INT_ALL and CE_STATEMENT_LINES_INTERFACE.
    I'm trying to put together an interface from Bank of America's Lockbox into our Oracle Receivables system (11.0.3), and don't have access to anything from which to start from.
    Thanks in Advance,
    Cam

    check it
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch10.htm#1656
    kuljeet pal singh

  • Question for SQL Loader / IMP /EXPORT

    hi all,
    i just describe my example first : -
    TABLE A have five columns.
    a_column,b_column,c_column,d_column,e_column.
    and have 1000 records.
    i want to remove c_column & e_column and add f_column.
    on TABLE A. which method (SQL Loader or IMP/EXP) is good suggestion for export & import data before take above action.
    boris

    Export/Import is the most appropiate solution for the task that you want to carry out because SQL*Loader is designed to load data into the database from flat files.
    Regarding how to drop the two columns , you can do it
    directly if you are working in 9i setting both columns as
    unused after drop unused columns in the table.
    Complete reference for those utilities:
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652.pdf
    Joel P�rez

  • Is license required for Sql Loader?

    I find that Sql Loader could save much time for me in bulk inserting.
    But I'm not sure whether license is required for using it in business software developing.
    Or is there any API that can provide similar functionality of Sql Loader?

    The sqlldr utility, expdp and impdp, and sqlplus come with the rdbms license. Earlier client software had the option of installing sqlldr, exp, and imp onto the client machine for use against a remote database. Being that expdp and impdp only run on the database server now these two utilities are probably not included but sqlldr may still be available as part of the client.
    HTH -- Mark D Powell --

  • Concatenating 2 files  in Unix and passing as input to SQL loader program

    Hi,
    I have 2 files file1_DDMMYY.csv and file_2_DDMMYY.csv
    I want to insert the 2 files using SQL Loader
    I am using the all_directories table to look at the directory path and file name passed for example \test\sdf\test\file_1_DDMMYY.csv
    I am presently using INFILE * in the Control File.Does it will take care of the 2 files for loading?Also the file  naming convention may vary depending upon the dates.for example it can have file_1_210214.csv or file_1_220214.
    Can we using concatenate and call the unix shell script and combine the 2 files to one and load the data using sql loader??
    How will be process of calling the shell program and pass the 2 files and combine it to one. (cat file_1_DDMMYY.csv file_2_DDMMYY.csv > file_1_DDMMYY.csv)
    Regards

    DUPLICATE thread
    FTPing multiple files in Server using Unix

  • DATE FORMAT Conversion FOR SQL Reports

    Hi,
    Am building a report and am stuck here where this piece of code that throws the following error
    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
    My query goes some thing like this
    DECLARE @StartDate varchar(15),
    @EndDate Varchar(15)
    SELECT @StartDate = '01/08/2014',
    @EndDate = '31/08/2014'
    SELECT DISTINCT
    [Operation] = CASE WHEN p.DATE_OF_START BETWEEN @StartDate AND @EndDate THEN 'Add'
    ELSE 'Update' END
    FROM SNZ_HR_Reporting_POSMGNT as s
    LEFT OUTER JOIN PERSON as p on s.EMP_NO = p.EMP_NO
    WHERE s.CHANGE_DATE BETWEEN @StartDate AND @EndDate
    The date format in the column DATE_OF_START  is like yyyy-mm-dd 00.00.00.000 .
    My question is how to convert this format to dd/mm/yyyy format and execute the queries
    Many Thanks,
    Bhanu

    SQL Date Format:
    http://www.sql-server-helper.com/tips/date-formats.aspx
    Please Mark This As Answer if it helps to solve the issue

Maybe you are looking for

  • IMac no longer sees Canon MP520

    I have had a Canon MP 520 connected by USB to my iMac for over a year. I have recently added an Airport Extreme wireless network to our home and have plugged in a HP 6500 printer that works on the network. Now my computer does not recognize the Canon

  • 1: N File Scenario..

    Hi, My Scenario is File to File Scenario, in which i need to drop the 2  target file in the ftp server in the same directory. For Eg: Source Fields: EMPNO ENAME Address Department ContactNumb 2 OUt PUt files that to be dropped as below: In the 1 st o

  • Electronic Bank Statement (EBS)

    Hi All, My Client is implemented Electronic Bank Statement using BAI format. GL Accounts set up is wrong (all bank accounts should be clearing type accounts (Open Item managed, except Operating Account (Main bank account))),but these accounts are not

  • Process does not end when binding a object to registry

    I am writing a Unit Test case in which i need to create a datasource and bind it to RMI registry so that the methods i need to test can get a database connection . The problem is that after the test cases have finished running the process does not en

  • Logging in Portal Iview

    Is there a sample for using "Logging" in an portal iview? I have found <a href="http://help.sap.com/saphelp_nw04/helpdata/en/e2/f410409f088f5ce10000000a155106/frameset.htm">SAP Help Logging</a> but I have difficults "translating" this sample into a p