Need help in using sql loader

Hi,
I am using sqlloader to load data from csv file to a table. csv file format is as below. And the condition is to load only data from locations DHL and ABC
item loc scheddate qty
10000001     DHL     7/13/2011     100
1000002     DHL     7/14/2011     10
101     ABC     7/15/2011     1000
10000002     ABC     7/16/2011     100
100 X 7/16/2011 0
and I am loading into table tab1
(note: there are few other cols which are nullable and don't want to isnert them)
here is the code I have written
LOAD DATA
INFILE file1.csv'
REPLACE
INTO TABLE tab1
WHEN (LOC = 'DHL')
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
ITEM,
LOC,
SCHEDDATE DATE "MM/DD/YYYY",
QTY,
EXPDATE DATE (:SCHEDDATE,'MM/DD/YYYY'),
STARTDATE DATE "MM/DD/YYYY" ":SCHEDDATE",
SEQNUM SEQUENCE(1000,1),
ORDERNUM CONSTANT "2",
INTEGRATION_JOBID CONSTANT "RBI603"
INTO TABLE igpmgr.INTINS_SCHEDRCPTS
WHEN (LOC = 'ABC')
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
ITEM,
LOC,
SCHEDDATE DATE "MM/DD/YYYY",
QTY,
EXPDATE DATE "MM/DD/YYYY" "to_char(to_date(:SCHEDDATE,'MM/DD/YYYY')+365,'DD/MM/YYYY')",
STARTDATE DATE "MM/DD/YYYY" ":SCHEDDATE",
SEQNUM SEQUENCE(1000,1),
ORDERNUM CONSTANT "2",
INTEGRATION_JOBID CONSTANT "RBI603"
But its only inserting rows from loc DHL and not from ABC...
Please help me..
Thanks,
Ravi.

Hello Ravi,
Based on your sample data, adding commas to match the field terminators specified in the control file:10000001,DHL,7/13/2011,100
1000002,DHL,7/14/2011,10
101,ABC,7/15/2011,1000
10000002,ABC,7/16/2011,100
100,X,7/16/2011,0Consider the following:LOAD DATA
INFILE test.csv'
APPEND
INTO TABLE tab1
WHEN (LOC = 'ABC')
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
( ITEM
, LOC
, SCHEDDATE          DATE "MM/DD/YYYY"
, QTY                                                -- moved to the fourth column to match the order presented in the sample data
, EXPDATE            DATE "MM/DD/YYYY"               -- changed specified date format to use double quotes instead of single quotes and swapped order of DD & MM to match SCHEDDATE in sample data, but also not present in the sample data, so would expect this to be treated as null, so not sure why it is specified
, STARTDATE          DATE "MM/DD/YYYY" ":SCHEDDATE"
, SEQNUM             SEQUENCE(1000,1)
, ORDERNUM           CONSTANT          "2"
, INTEGRATION_JOBID  CONSTANT          "RBI603"
INTO TABLE tab1
WHEN (LOC = 'DEF')
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
( ITEM               POSITION(1)                     -- added POSITION(1) to allow sqlldr to start reading from the beginning of the line
, LOC
, SCHEDDATE          DATE "MM/DD/YYYY"
, QTY                                                -- moved to the fourth column to match the order presented in the sample data
, EXPDATE            DATE "MM/DD/YYYY"               -- not present in the sample data, so would expect this to be treated as null, so not sure why it is specified
, STARTDATE          DATE "MM/DD/YYYY" ":SCHEDDATE"
, SEQNUM             SEQUENCE(1000,1)
, ORDERNUM           CONSTANT          "2"
, INTEGRATION_JOBID  CONSTANT          "RBI603"
)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 actual or sample statements and the full text of errors along with error code to help the forum members help you better.

Similar Messages

  • Need help to run sql loader from Form6i

    Hi All,
    I have some problem with the sql loader running from form 6i.
    I have done following steps for that.
    1. have created bat file to run sql loader.
    2.Alos created ctl and txt files inside the same folder.
    In the form , in button press i have written below code
    HOST('cmd /c C:\load1.bat > C:\output.txt');
    But it is giving error as -
    "Unable to open Load1.ctl."
    but i have run that bat files from command prompt ; and it is running fine.
    I guess probably it is not getting the correct path.
    Will pls help me, wt exacly I'm doing wrong?
    Rg,
    Subir

    Hi Francois,
    Thanks for reply.
    It is not a problem with the batch files. Coz, I just able to run batch files, but that is not correct solution.
    Once the host command id firing, that time it is going to path -
    "c:\orant\Form60\"
    And in this path it searching for that batch files and all the require files; but the require files are present in some different folder. So i think I need to change the path as well, but that I'm unable to do.
    To resolve the problem, I have copied all the files in "c:\orant\Form60\" folder, and then it is working.
    So I think I need to changed the path, so how to change the path. If I able to change the path I think it will worked. How to change the path?
    Best Rg,
    Subir

  • Need help in using SQL in a jsp file to compare date and time

    hi every one,
    Actually I am doing a project using JSP. I need to compare a date field in the database (MS Acess) to the current system date and time. I have to do this in a select statement.
    I have alredy defined a variable of type Date in the JSP file and I am comparing this variable to the date in the database through a select statemant.
    Here is what I am doing
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
              java.util.Date today = new java.util.Date();
              String myDate=sdf.format(today);
    query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= "+myDate+" ;";
    EDate is the feild in the database and it's format is (5/12/2008 5:29:47 PM) it is of type Date/Time in MS Acess.
    when I execute the query it gives the following error
    SQL error:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'EDate <= 2008-10-16 08:10:07'.
    I hope any one can help me with that error and answer my question, I've tried too many things but nothing helps
    Thanks in advance :-)

    Hi,
    When the comparision is needed to be done with the current date , we don't need to send in Java
    Date then format it and compare with MS Acess Date.
    In MS Access we have Date() function which will give you the current date.
    So you can try rewriting your query as following :
    query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= Date() ;"; ---------------------
    Hope this helps.
    Thanks

  • Using sql loader

    hi
    I need some help in using sql loader in windows xp to do some practice.
    i know we have to use below command in unix but what was the command to use in windows.
    sqlldr userid=scott/tiger control=ulcase1.ctl log=ulcase1.log
    thanks in advance...

    sam482 wrote:
    hi
    I need some help in using sql loader in windows xp to do some practice.
    i know we have to use below command in unix but what was the command to use in windows.
    sqlldr userid=scott/tiger control=ulcase1.ctl log=ulcase1.logSearch on you Windows XP oracle directory for *.ctl you will find there are files the control loader files used to create/populate the records for the demo schema. So if you can dig deeper you will find more things demos of sql/java/procedures etc.
    I am assuming you have installed oracle on you Windows XP, if not install and check it out.
    SS

  • Need suggestions on loading 5000+ files using sql loader

    Hi Guys,
    I'm writing a shell script to load more than 5000 files using sql loader.
    My intention is to load the files in parallel. When I checked the maximum number of sessions in v$parameter, it is around 700.
    Before starting the data load, programmatically I am getting the number of current sessions and maximum number of sessions and keeping free 200 sessions without using them (max. no. of sessions minus 200 ) and utilizing the remaining ~300 sessions to load the files in parallel.
    Also I am using a "wait" option to make the shell to wait until the 300 concurrent sql loader process to complete and moving further.
    Is there any way to make it more efficient? Also is it possible to reduce the wait time without hard coding the seconds (For Example: If any of those 300 sessions becomes free, assign the next file to the job queue and so on..)
    Please share your thoughts on this.
    Thanks.

    Manohar wrote:
    I'm writing a shell script to load more than 5000 files using sql loader.
    My intention is to load the files in parallel. When I checked the maximum number of sessions in v$parameter, it is around 700. Concurrent load you mean? Parallel processing implies take a workload, breaking that up into smaller workloads, and doing that in parallel. This is what the Parallel Query feature does in Oracle.
    SQL*Loader does not do that for you. It uses a single session to load a single file. To make it run in parallel, requires manually starting multiple loader sessions and perform concurrent loads.
    Have a look at Parallel Data Loading Models in the Oracle® Database Utilities guide. It goes into detail on how to perform concurrent loads. But you need to parallelise that workload yourself (as explained in the manual).
    Before starting the data load, programmatically I am getting the number of current sessions and maximum number of sessions and keeping free 200 sessions without using them (max. no. of sessions minus 200 ) and utilizing the remaining ~300 sessions to load the files in parallel.
    Also I am using a "wait" option to make the shell to wait until the 300 concurrent sql loader process to complete and moving further.
    Is there any way to make it more efficient? Also is it possible to reduce the wait time without hard coding the seconds (For Example: If any of those 300 sessions becomes free, assign the next file to the job queue and so on..)Consider doing it the way that Parallel Query does (as I've mentioned above). Take the workload (all files). Break the workload up into smaller sub-workloads (e.g. 50 files to be loaded by a process). Start a 100 processes in parallel and provide each one with a sub-workload to do (100 processes each loading 50 odd files).
    This is a lot easier to manage than starting for example a 5000 load processes and then trying some kind of delay method to ensure that not all hit the database at the same time.
    I'm loading about 100+ files (3+ million rows) every 60 seconds 24x7 using SQL*Loader. Oracle is quite scalable and SQL*Loader quite capable.

  • Loading XML file using sql*loader (10g)

    Hi Everyone....
    I have a major problem. I have a 10g database and I need to use sql loader to load a large XML file into the database. This file contains records for many, many customers. This will be done several times and the number of records will vary. I want to use sql loader and load to a staging table, BUT SPLIT THE RECORDS OUT and add a sequence. I am having 2 problems.
    In the 10g documentation, when you want to split the records you use the BEGINDATA clause and indicate something (like a 0) for each instance of a record. Well my first file has 3,722 records in it. How do I know the number of records in each XML file?
    The second problem is that because this is XML, I thought that I could use ENCLOSED BY. But the start tag has an attribute /counter in it, sql*loader doesnt recognize the starting tag. (i.e.: start tag is: </CustomerRec number=1>
    end tag is: </CustomerRec> )
    So, I used TERMINATED BY '</CustomerRec>'. This will split out the records, but it will NOT include the ending tag of </CustomerRec> and when I use extract, I receive an XML parsing error.
    I have tried to get the ending tag using CONTINUEIF and SKIP. But those options are for "records" and not lines.
    Does anyone have any ideas for the 2 problems above. I am at my wits end and I need to finish this ASAP. Any help would be appreciated.
    Thank you!

    Sorry.... here is an example of what my control file looks like. At the end, I have 92 "0", but remember, I have 3722 records in this first file.
    LOAD DATA (SKIP 1)
    INFILE *
    INTO TABLE RETURN_DATA_STG
    TRUNCATE
    XMLType(xmldata)
    FIELDS
    (fill FILLER CHAR(1),
    loadseq SEQUENCE(MAX,1),
    xmldata LOBFILE (CONSTANT F001AB.XML)
    TERMINATED BY '</ExtractObject>'
    ------ ":xmldata||'</ExtractObject>'"
    BEGINDATA
    0
    0
    0
    0
    0
    0

  • Loading millions of rows using SQL*loader to a table with constraints

    I have a table with constraints and I need to load millions of rows in it using SQL*Loader.
    What is the best way to do this, means what SQL*Loader options to use, for getting the best loading performance and how to deal with constraints?
    Regards

    - check if your table has check constraints (like column not null)
    if you trust the data in the file you have to load you can disable this constrainst and after the loader enable this constrainst.
    - Check if you can modify the table and place it in nologging mode (generate less redo but ONLY is SOME Conditions)
    Hope it helps
    Rui Madaleno

  • Using SQL Loader to insert data based on conditionally statements

    I would like to use sql loader to insert records from a single text file into an Oracle database table. Sounds easy but the problem is that I need to check the existence of data in another table (Table A) before data can be loaded into Table B.
    Table A has two columns: dept_no (primary key value) and dept_name (char)
    Table B has five columns: emp_no (primary key value), dept_no (foreign key value to Table A), employee (char), job_title (char) and salary (number)
    Text File looks like this:
    Finance Jones President 10000
    HR Smith Admin 2000
    HelpDesk Jenkins Technician 3000
    Problem:
    1. I need sql loader to insert records into Table B by first checking if the first field in the file is in Table A.
    2. If value exists get it's dept_no value.
    3. If value doesn't exist discard record ( I might want to have sql loader insert a new record for this into Table A)
    4. Using value from #2, insert the value in Table B for dept_no column.
    5. Also assign a sequence value for the emp_no value in Table B.
    Any guidance is greatly appreciated.
    Thanks,

    Hello,
    I am not sure this is possible with SQL loader. I would rather use an external table based on your file.
    Then, I would use SQL to load your data into your table, based on your conditions.
    Your request is not very complicated, writing the SQL to do that will be really more simple than trying to do it with SQL loader.
    Hope it will help.
    Regards,
    Sylvie

  • How to use SQL*LOADER to read data in |SMITH|ALFRED| format

    the data I need to upload to table using SQL*LOADER is in format as below:
    |AD |Argentina  |
    |CN |China       |
    |US |America            |
    |GB |England        |so how should I write my control file to read the data into two columns table?
    I googled and people say that use Enclosed fields—delimiter (|), and I tried with below, but not working:
    LOAD DATA
    INFILE *
    insert
    INTO TABLE tmp_country_mapping
    FIELDS ENCLOSED BY '|'
    (country_id, country_name)
    BEGINDATA
    |AD |Argentina  |
    |CN |China       |
    |US |America            |
    |GB |England        |Anyone could help?
    BTW, I don`t want the spaces behind the value of the second column.
    Thanks
    Edited by: PhoenixBai on Dec 28, 2010 2:50 PM

    Problem solved, by removing the NLS_LANG=ENGLISH.
    >
    before the load, data is as below:
    |AD |安道尔共和国         |
    |AE |阿联酋            |
    |AF |阿富汗            |
    |AG |安提瓜和巴布达        |
    |AI |安圭拉岛           |
    |AL |阿尔巴尼亚          |after the load, data displays as below:
    AD      °2μà??12oí1ú
    AE      °¢áa??
    AF      °¢??o1
    AG      °2ìá1?oí°í2?′?
    AI      °21?à-μo
    AL      °¢??°í?á??And my database supports Chinese words and it displays correctly for other tables, except this one.
    What could be the problem?
    >
    Edited by: PhoenixBai on Dec 28, 2010 5:05 PM

  • How to load a default value in to a column when using sql loader

    Im trying to load from a flat file using sql loader.
    for 1 column i need to update using a default value
    how to go about this?

    Hi!
    try this code --
    LOAD DATA
       INFILE 'sample.dat'
       REPLACE
       INTO TABLE emp
       empno   POSITION(01:04) INTEGER EXTERNAL NULLIF empno=BLANKS,
       ename   POSITION(06:15)  CHAR,
       job         POSITION(17:25)  CHAR,
       mgr       POSITION(27:30)  INTEGER EXTERNAL NULLIF mgr=BLANKS,
       sal        POSITION(32:39)  DECIMAL EXTERNAL NULLIF sal=BLANKS,
       comm   POSITION(41:48)  DECIMAL EXTERNAL DEFAULTIF comm = 100,
       deptno  POSITION(50:51)  INTEGER EXTERNAL NULLIF deptno=BLANKS,
       hiredate POSITION(52:62) CONSTANT SYSDATE
      )-hope this will solve ur purpose.
    Regards.
    Satyaki De.

  • Load XML File into temporary tables using sql loader

    Hi All,
    I have an XML file as below. I need to insert the contents into a temporary staging table using sql loader. Please advice how I need to do that.
    For example Portfolios should go into a seperate table, and all the tags inside it should be populated in the columns of the table.
    Family should go into a seperate table and all the tags inside it should be populated in the columns of the table.
    Similarly offer, Products etc.
    - <ABSProductCatalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    - <ProductSalesHierachy>
    - <Portfolios>
    - <Portfolio productCode="P1">
      <Attribute name="CatalogProductName" value="Access" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
    - <Portfolio productCode="P2">
      <Attribute name="CatalogProductName" value="Data" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
    - <Portfolio productCode="P3">
      <Attribute name="CatalogProductName" value="Voice" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
    - <Portfolio productCode="P4">
      <Attribute name="CatalogProductName" value="Wireless" />
      <Attribute name="Status" value="Active" />
      </Portfolio>
      </Portfolios>
    - <Families>
    - <Family productCode="F1">
      <Attribute name="CatalogProductName" value="Internet Access Services" />
      <Attribute name="Status" value="Active" />
    - <ParentHierarchy>
      <Item productCode="P1" modelType="Portfolio" />
      </ParentHierarchy>
      </Family>
    - <Family productCode="F2">
      <Attribute name="CatalogProductName" value="Local Access Services" />
      <Attribute name="Status" value="Active" />
    - <ParentHierarchy>
      <Item productCode="P2" modelType="Portfolio" />
      </ParentHierarchy>
      </Family>
      </Families>
    - <SubFamilies>
    - <SubFamily productCode="SF1">
      <Attribute name="CatalogProductName" value="Business Internet service" />
      <Attribute name="Status" value="Active" />
    - <ParentHierarchy>
      <Item productCode="F1" modelType="Family" />
      </ParentHierarchy>
      </SubFamily>
      </SubFamilies>
    - <ProductRefs>
    - <ProductRef productCode="WSP1" modelType="Wireline Sales Product">
      <ActiveFlag>Y</ActiveFlag>
    - <ProductHierarchy>
      <SalesHierarchy family="F1" subFamily="SF1" portfolio="P1" primary="Y" />
      <SalesHierarchy family="F2" portfolio="P2" primary="N" />
      <FinancialHierarchy quotaBucket="Voice" strategicProdCategory="Local Voice" />
      </ProductHierarchy>
      </ProductRef>
    - <ProductRef productCode="MSP2" modelType="Handset">
      <ActiveFlag>Y</ActiveFlag>
    - <ProductHierarchy>
      <SalesHierarchy portfolio="P4" primary="Y" />
      </ProductHierarchy>
      </ProductRef>
      </ProductRefs>
      </ProductSalesHierachy>
    - <Offers>
    - <Offer productCode="ABN">
      <OfferName>ABN</OfferName>
      <OfferDescription>ABN Description</OfferDescription>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      </Segments>
      <OfferUpdateDate>2009-11-20</OfferUpdateDate>
      <ActiveFlag>Y</ActiveFlag>
      </Offer>
    - <Offer productCode="OneNet">
      <OfferName>OneNet</OfferName>
      <OfferDescription>OneNet Description</OfferDescription>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      <Segment>PCG2</Segment>
      </Segments>
      <OfferUpdateDate>2009-11-20</OfferUpdateDate>
      <ActiveFlag>Y</ActiveFlag>
      </Offer>
      </Offers>
    - <Products>
    - <Product productCode="WSP1" modelType="Wireline Sales Product">
      <ProductName>AT&T High Speed Internet</ProductName>
      <ProductDescription>High Speed Internet</ProductDescription>
      <LegacyCoProdIndicator>SBC</LegacyCoProdIndicator>
      <RevenueCBLCode>1234B</RevenueCBLCode>
      <VolumeCBLCode>4567A</VolumeCBLCode>
      <SAARTServiceIDCode>S1234</SAARTServiceIDCode>
      <MarginPercentRequired>Y</MarginPercentRequired>
      <PercentIntl>%234</PercentIntl>
      <UOM>Each</UOM>
      <PriceType>OneTime</PriceType>
      <ProductStatus>Active</ProductStatus>
      <Compensable>Y</Compensable>
      <Jurisdiction>Everywhere</Jurisdiction>
      <ActiveFlag>Y</ActiveFlag>
    - <Availabilities>
      <Availability>SE</Availability>
      <Availability>E</Availability>
      </Availabilities>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      </Segments>
      <VDIndicator>Voice</VDIndicator>
      <PSOCCode>PSOC 1</PSOCCode>
      <USBilled>Y</USBilled>
      <MOWBilled>N</MOWBilled>
      <ProductStartDate>2009-11-20</ProductStartDate>
      <ProductUpdateDate>2009-11-20</ProductUpdateDate>
      <ProductEndDate>2010-11-20</ProductEndDate>
    - <AliasNames>
      <AliasName>AT&T HSI</AliasName>
      <AliasName>AT&T Fast Internet</AliasName>
      </AliasNames>
    - <OfferTypes>
      <OfferType productCode="ABN" endDate="2009-11-20" />
      <OfferType productCode="OneNet" />
      </OfferTypes>
    - <DynamicAttributes>
    - <DynamicAttribute dataType="String" defaultValue="2.5 Mbps" name="Speed">
      <AttrValue>1.5 Mbps</AttrValue>
      <AttrValue>2.5 Mbps</AttrValue>
      <AttrValue>3.5 Mbps</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="TransportType">
      <AttrValue>T1</AttrValue>
      </DynamicAttribute>
      </DynamicAttributes>
      </Product>
    - <Product productCode="MSP2" modelType="Handset">
      <ProductName>Blackberry Bold</ProductName>
      <ProductDescription>Blackberry Bold Phone</ProductDescription>
      <LegacyCoProdIndicator />
      <RevenueCBLCode />
      <VolumeCBLCode />
      <SAARTServiceIDCode />
      <MarginPercentRequired />
      <PercentIntl />
      <UOM>Each</UOM>
      <PriceType />
      <ProductStatus>Active</ProductStatus>
      <Compensable />
      <Jurisdiction />
      <ActiveFlag>Y</ActiveFlag>
    - <Availabilities>
      <Availability />
      </Availabilities>
    - <Segments>
      <Segment>SCG</Segment>
      <Segment>PCG</Segment>
      </Segments>
      <VDIndicator>Voice</VDIndicator>
      <PSOCCode />
      <USBilled />
      <MOWBilled />
      <ProductStartDate>2009-11-20</ProductStartDate>
      <ProductUpdateDate>2009-11-20</ProductUpdateDate>
    - <AliasNames>
      <AliasName />
      </AliasNames>
    - <OfferTypes>
      <OfferType productCode="ABN" />
      </OfferTypes>
    - <DynamicAttributes>
    - <DynamicAttribute dataType="String" name="StlmntContractType">
      <AttrValue />
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="BMG 2 year price">
      <AttrValue>20</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="MSRP">
      <AttrValue>40</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="BMGAvailableType">
      <AttrValue />
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="ProductId">
      <AttrValue>123456</AttrValue>
      </DynamicAttribute>
    - <DynamicAttribute dataType="String" name="modelSource">
      <AttrValue>product</AttrValue>
      </DynamicAttribute>
      </DynamicAttributes>
      </Product>
      </Products>
      <CatalogChanged>Y</CatalogChanged>
      </ABSProductCatalog>

    Two options that come to mind. Others exist.
    #1 - {thread:id=474031}, which is basically storing the XML in an Object Relational structure for parsing
    #2 - Dump the XML into either an XMLType based table or column and use SQL (with XMLTable) to create a view that parses the data. This would be the same as the view shown in the above post.
    Don't use sql*loader to parse the XML. I was trying to find a post from mdrake about that but couldn't. In short, sql*loader was not build as an XML parser so don't try to use it that way.

  • How to Load Arabic Data from flat file using SQL Loader ?

    Hi All,
    We need to load Arabic data from an xls file to Oracle database, Request you to provide a very good note/step to achieve the same.
    Below are the database parameters used
    NLS_CHARACTERSET AR8ISO8859P6
    nls_language american
    DB version:-10g release 2
    OS: rhel 5
    Thanks in advance,
    Satish

    Try to save your XLS file into CSV format and set either NLS_LANG to the right value or use SQL*Loader control file parameter CHARACTERSET.
    See http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005287

  • How to use Sql Loader in Unix Environmant

    Hi All,
    Can anyone explain me please how to use sql Loader in unix environment.
    Actually i have one control file i want to run that file in Unix how can i achive please explain me
    Thank's

    Hi Kuljeet,
    Thank you for your replay
    I just put my control file into the Unix Environmant that's fime
    and when i trying to entering the following cmd in Unix environment i am getting this error
    sqlldr username/password@string control='unix_pathname'i am not sure about the path name my question is
    1) Do i need to give the Local file Path Or Unix Path
    This is  the error in Sql Loader:
    SQL*Loader: Release 10.2.0.4.0 - Production on Mon Sep 24 13:14:23 2012
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    SQL*Loader-500: Unable to open file (/bx167a/riskbatch/rdwdbat/sample_upl.upl)
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    Could you please correct me
    Thank's

  • ORA-01841 Error when value for date col is NULL in .dat (using SQL Loader)

    Hello Gurus,
    I have some data in .dat file which needs to be loaded into oracle table. I am using SQL * Loader to do the job. Although "NULLIF col_name =BLANKS" works for character datatype, but when value for date col is NULL then I get ORA-01841 error. I have to make NULL for all rows withour value for date column
    Early reply will be highly appreciated
    Farooq

    Hi,
    May be this problem is not with the NULLIF. The value for the date column is not in proper date format.
    create table:
    create table kk (empno number, ename varchar2(20), deptno number, hiredate date)
    Control file:
    LOAD DATA
    INFILE 'd:\kk\empdata.dat'
    insert into TABLE kk ( empno position (1:2) integer external,
    ename position(4:5) char NULLIF ename=BLANKS,
    deptno position (7:8) integer external NULLIF deptno=BLANKS,
    hiredate position (10:20) date NULLIF hiredate=BLANKS)
    data file:
    10 KK 01-jan-2005
    20 10
    SELECT * FROM KK;
    EMPNO ENAME DEPTNO HIREDATE
    10 KK 01-JAN-05
    20 10
    Verify the data file.
    Hope it will help

  • Using SQL*Loader and UTL_FILE to load and unload large files(i.e PDF,DOCs)

    Problem : Load PDF or similiar files( stored at operating system) into an oracle table using SQl*Loader .
    and than Unload the files back from oracle tables to prevoius format.
    I 've used SQL*LOADER .... " sqlldr " command as :
    " sqlldr scott/[email protected] control=c:\sqlldr\control.ctl log=c:\any.txt "
    Control file is written as :
    LOAD DATA
    INFILE 'c:\sqlldr\r_sqlldr.txt'
    REPLACE
    INTO table r_sqlldr
    Fields terminated by ','
    id sequence (max,1) ,
    fname char(20),
    data LOBFILE(fname) terminated by EOF )
    It loads files ( Pdf, Image and more...) that are mentioned in file r_sqlldr.txt into oracle table r_sqlldr
    Text file ( used as source ) is written as :
    c:\kalam.pdf,
    c:\CTSlogo1.bmp
    c:\any1.txt
    after this load ....i used UTL_FILE to unload data and write procedure like ...
    CREATE OR REPLACE PROCEDURE R_UTL AS
    l_file UTL_FILE.FILE_TYPE;
    l_buffer RAW(32767);
    l_amount BINARY_INTEGER ;
    l_pos INTEGER := 1;
    l_blob BLOB;
    l_blob_len INTEGER;
    BEGIN
    SELECT data
    INTO l_blob
    FROM r_sqlldr
    where id= 1;
    l_blob_len := DBMS_LOB.GETLENGTH(l_blob);
    DBMS_OUTPUT.PUT_LINE('blob length : ' || l_blob_len);
    IF (l_blob_len < 32767) THEN
    l_amount :=l_blob_len;
    ELSE
    l_amount := 32767;
    END IF;
    DBMS_LOB.OPEN(l_blob, DBMS_LOB.LOB_READONLY);
    l_file := UTL_FILE.FOPEN('DBDIR1','Kalam_out.pdf','w', 32767);
    DBMS_OUTPUT.PUT_LINE('File opened');
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.READ (l_blob, l_amount, l_pos, l_buffer);
    DBMS_OUTPUT.PUT_LINE('Blob read');
    l_pos := l_pos + l_amount;
    UTL_FILE.PUT_RAW(l_file, l_buffer, TRUE);
    DBMS_OUTPUT.PUT_LINE('writing to file');
    UTL_FILE.FFLUSH(l_file);
    UTL_FILE.NEW_LINE(l_file);
    END LOOP;
    UTL_FILE.FFLUSH(l_file);
    UTL_FILE.FCLOSE(l_file);
    DBMS_OUTPUT.PUT_LINE('File closed');
    DBMS_LOB.CLOSE(l_blob);
    EXCEPTION
    WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN(l_file) THEN
    UTL_FILE.FCLOSE(l_file);
    END IF;
    DBMS_OUTPUT.PUT_LINE('Its working at last');
    END R_UTL;
    This loads data from r_sqlldr table (BOLBS) to files on operating system ,,,
    -> Same procedure with minor changes is used to unload other similar files like Images and text files.
    In above example : Loading : 3 files 1) Kalam.pdf 2) CTSlogo1.bmp 3) any1.txt are loaded into oracle table r_sqlldr 's 3 rows respectively.
    file names into fname column and corresponding data into data ( BLOB) column.
    Unload : And than these files are loaded back into their previous format to operating system using UTL_FILE feature of oracle.
    so PROBLEM IS : Actual capacity (size ) of these files is getting unloaded back but with quality decreased. And PDF file doesnt even view its data. means size is almot equal to source file but data are lost when i open it.....
    and for images .... imgaes are getting loaded an unloaded but with colors changed ....
    Also features ( like FFLUSH ) of Oracle 've been used but it never worked
    ANY SUGGESTIONS OR aLTERNATE SOLUTION TO LOAD AND UNLOAD PDFs through Oracle ARE REQUESTED.
    ------------------------------------------------------------------------------------------------------------------------

    Thanks Justin ...for a quick response ...
    well ... i am loading data into BLOB only and using SQL*Loader ...
    I've never used dbms_lob.loadFromFile to do the loads ...
    i 've opend a file on network and than used dbms_lob.read and
    UTL_FILE.PUT_RAW to read and write data into target file.
    actually ...my process is working fine with text files but not with PDF and IMAGES ...
    and your doubt of ..."Is the data the proper length after reading it in?" ..m not getting wat r you asking ...but ... i think regarding data length ..there is no problem... except ... source PDF length is 90.4 kb ..and Target is 90.8 kb..
    thats it...
    So Request u to add some more help ......or should i provide some more details ??

Maybe you are looking for

  • How can I adjust event window size while in day view on ical?

    How can I adjust the all-day event window size while in day view on ical?  I have thee all-day events, but they're just a little too big to simultaneously appear without having to scroll up/down the all-day event section.

  • Only able to view some PDFs on black berry

    I able to view pdf files that are created with the info in the PDF tab under Properties thats states: PDF Producer: Acrobat Distiller 8.1.0 (Macintosh) PDF version: 1.4 I receive a PDF with this Info and it does not work: PDF Producer: Adobe PDF libr

  • SXMB_MONI Error: Receiver: Header before undo of mapping

    Hi, I have created webservice using a service interface, when I try to test this interface using WS Navigator then I am getting below error in trace. The message is showing status "Application Error- Restart Not Possible"   <Trace level="2" type="T">

  • How to Mount Another mac on Network at start up

    Hello kind people I have a MacPro and Powerbook G4 on my gigbit ethernet network at home. I can use the finder on MacPro to locate my Powerbook and connect as a registered uder no problem. However I would like the MacPro to mount the Powerbook automa

  • Lighroom 5.7 not updating to 6 ?

    My CC lightroom 5.7 not updating to 6.  I did install update on Creative Cloud. Thanks !!