SQL Loader and control file

I know I've done this before but, I don't use SQL Loader often and I'm having issues getting a file to load.
The table has 6 columns in it - one of which is a timestamp.
I was having issues loading it initially with date format issues. I ruled out any issues with the timestamp format by simply loading a dummy table with some timestamp based data and had no issue.
So - I think the issue is around the fact that the table I'm loading's first column being a value I'm attempting to default with a sequence when loading and - that I'm screwing up something there.
Table is as such:
CREATE TABLE ACS_IPS
    (seq_ips NUMBER,
    col2   VARCHAR2(100),
    col3  VARCHAR2(100),
    col4    VARCHAR2(100),
    col5 TIMESTAMP,
    col6    VARCHAR2(100),
    col7    VARCHAR2(100),
    col8 DATE  DEFAULT SYSDATE NOT NULL,
    col9 VARCHAR2(30) DEFAULT USER);The control file is:
load data
truncate
into table acs_ips
fields terminated by ","
trailing nullcols
    seq_ips "seq_ips.nextval",
    col2,
    col3,
    col4,
    col5 TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF9",
    col6,
    col7
    )The sequence column isn't in the file being loaded... and - there are additional columns that are defaulted on the table that aren't in the control file.
Any help is appreciated... The error I'm getting is:
Rejected - Error on table CAMS.ACS_IPS, column ACTION_START.
ORA-01841: (full) year must be between -4713 and +9999, and not be 0

Yeah - not sure that clears it up...
The sequence in my table is the first column - and - I think that's the problem... the sequence is being loaded as the first column in the control file but - it's not in the file being loaded so - it's skewing (again - I think??) the data being read in - which is why I'm getting the timestamp issues on the one column (it's actually reading the next column in the file vs. the actual timestamp one).
If that's the issue - I'm not sure how to avoid it without restructuring the table to stick the sequence physically at the end. I'm certain that's not necessary and - I'm overlooking something that's otherwise simple but evading me.

Similar Messages

  • SQL Loader and control file changes for different users

    In the front end of my application I can select a data file and a control file, and load data to the table mentioned in .ctl file. Every user who logs in uses the same .ctl file and so loads onto the same table. Now I want the user to load data onto the table in his own schema. I can get the username of the user currently logged in and i want to insert it into that username.table. So can i copy the contents of the .ctl file into a variable, modify it into username.table in that string and pass that variable as a parameter to the sqlldr command instead of the .ctl file.
    Or is there a better way how I can modify the same control file everytime to change tablename to username.tablename in .ctl file and pass to sqlldr to load data to table in local user schema table.
    Thanks and Regards

    Thanks for the reply .. user do have their user credentials but only for the application ... but all users use a common loader and control file once they log into the application. So irrespective of which user is logged in he selects the same control file and loads to the same table mentioned in the control file .. i instead want user to be able to load to the table in control file but into his schema like username.tablename instead of just the tablename mentioned in .ctl file.

  • SQL Loader and control files with WHEN clauses

    Hi All :)
    Want to load data into 3 tables that are defined like so:
    SQL> desc PARENT
    Name NULL? Type
    PKey.........NOT NULL....Number
    Blah_One.................VARHCAR2(50)
    Blah_Two.................VARHCAR2(50)
    SQL> desc CHILD_ONE
    Name NULL? Type
    PKey.........NOT NULL....Number
    FKey.....................Number -- this is used as a Foriegn key to PARNET
    Bleep_One................VARHCAR2(50)
    SQL> desc CHILD_TWO
    Name NULL? Type
    PKey.........NOT NULL....Number
    FKey.....................Number -- this is used as a Foriegn key to PARNET
    Bleep_Two................VARHCAR2(50)
    I have a flat file that looks like this
    PARENT|BLAHBLAH|Blahba|
    ONE|BLEEP-IT|
    ONE|BLEEP-BLOP|
    TWO|TWOBLEEP|
    TWO|OR NOT TO|
    TWO|BLEEP
    PARENT|AbbaDabaDooo|whaaaaa|
    TWO|waka=waka|
    .... so I worte a control file that looks like this ....
    LOAD DATA
    APPEND
    INTO PARENT
    WHEN (tableName='PARENT')
    FIELDS TERMINATED BY '|' TRAILING NULLCOLS
    tableName FILLER,
    BLAH_ONE,
    BLAH_TWO,
    PKey "PARENT_SEQ.nextval"
    INTO CHILD_ONE
    WHEN (tableName='ONE')
    FIELDS TERMINATED BY '|' TRAILING NULLCOLS
    tableName FILLER,
    BLEEP_ONE,
    PKey "CHILD_ONE_SEQ.nextval",
    FKey "PARENT_SEQ.currval"
    INTO CHILD_TWO
    WHEN (tableName='TWO')
    FIELDS TERMINATED BY '|' TRAILING NULLCOLS
    tableName FILLER,
    BLEEP_TWO,
    PKey "CHILD_TWO_SEQ.nextval",
    FKey "PARENT_SEQ.currval"
    where PARENT_SEQ, CHILD_ONE, and CHILD_TWO
    are SEQUENCES.
    The probelm I am having is that the Fkeys and PKeys
    don't match up????
    Am I mis-using SEQUENCES?
    Should I be using a trigger?
    I am very confused!
    Thanks

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6020061915147
    answers this question perfectly

  • Problem import csv file with SQL*loader and control file

    I have a *csv file looking like this:
    E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
    E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
    E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
    E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
    E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
    E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
    I want to import this csv file to this table:
    create table artikel (artnr varchar2(10), namn varchar2(25), fp_storlek number, datum date, mtrlid varchar2(5), pris number);
    My controlfile looks like this:
    LOAD DATA
    INFILE 'e:\test.csv'
    INSERT
    INTO TABLE ARTIKEL
    FIELDS TERMINATED BY ';'
    TRAILING NULLCOLS
    (ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
    I cant get sql*loader to import the last column(pris) as I want. It ignore my decimal point which in this case is "," and not "." maybe this is the problem. If the decimal point is the problem how can I get oracle to recognize "," as a decimal point??
    the result from the import now, is that a decimal number (37,2) becomes 372 in the table

    Set NLS_NUMERIC_CHARACTERS environment variable at OS level, before running SqlLoader :
    $ cat test.csv
    E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
    E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
    E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
    E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
    E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
    E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
    $ cat artikel.ctl
    LOAD DATA
    INFILE 'test.csv'
    replace
    INTO TABLE ARTIKEL
    FIELDS TERMINATED BY ';'
    TRAILING NULLCOLS
    (ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
    $ sqlldr scott/tiger control=artikel
    SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:01 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Commit point reached - logical record count 6
    $ sqlplus scott/tiger
    SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:11 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from artikel;
    ARTNR      NAMN                      FP_STORLEK DATUM      MTRLI       PRIS
    E0100070   EKKJ 1X10/10 1 KV                  1 16/06/2003 01C           75
    E0100075   EKKJ 1X10/10 1 KV                500 16/06/2003 01C           67
    E0100440   EKKJ 2X2,5/2,5 1 KV                1 16/06/2003 01C          372
    E0100445   EKKJ 2X2,5/2,5 1 KV              500 16/06/2003 01C          332
    E0100450   EKKJ 2X4/4 1 KV                    1 16/06/2003 01C           53
    E0100455   EKKJ 2X4/4 1 KV                  500 16/06/2003 01C          471
    6 rows selected.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    $ export NLS_NUMERIC_CHARACTERS=',.'
    $ sqlldr scott/tiger control=artikel
    SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:41 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Commit point reached - logical record count 6
    $ sqlplus scott/tiger
    SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:45 2005
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from artikel;
    ARTNR      NAMN                      FP_STORLEK DATUM      MTRLI       PRIS
    E0100070   EKKJ 1X10/10 1 KV                  1 16/06/2003 01C           75
    E0100075   EKKJ 1X10/10 1 KV                500 16/06/2003 01C           67
    E0100440   EKKJ 2X2,5/2,5 1 KV                1 16/06/2003 01C         37,2
    E0100445   EKKJ 2X2,5/2,5 1 KV              500 16/06/2003 01C         33,2
    E0100450   EKKJ 2X4/4 1 KV                    1 16/06/2003 01C           53
    E0100455   EKKJ 2X4/4 1 KV                  500 16/06/2003 01C         47,1
    6 rows selected.
    SQL>                                                                            Control file is exactly as yours, I just put replace instead of insert.

  • SQL loader and stream files with new line '

    I have been trying unsuccessfully to load EDI files using SQL loader. The problem
    is that the lines are terminated by ' and when I use the stream file option it does
    not recognise the line terminator given. As I understand it from the documentation
    this should work - but it does not. I have also used the Hex option with no better
    result. Does anyone have any ideas ?
    I can and have used tr "[']" "[\n]" in Unix to convert the ' to newlines - I just
    wonder am I missing something in SQL loader which will allow me to do this ?
    This is the sql loader control file
    LOAD DATA
    INFILE 'WS860685.MFD' "Str ''' "
    BADFILE 'WS860685.bad'
    DISCARDFILE 'WS860685.dsc'
    INTO TABLE "DUND1"."EDI_LOADED_TEMP"
    REPLACE
    FIELDS TERMINATED BY '+'
    TRAILING NULLCOLS
    (L1,
    L2,
    L3,
    L4,
    L5,
    L6,
    L7,
    L8,
    L9,
    L10,
    L11,
    L12,
    L13,
    L14,
    L15,
    L16,
    L17,
    L18,
    L19,
    L20,
    L21,
    L22,
    L23,
    L24,
    L25,
    L26,
    L27,
    L28,
    L29,
    L30,
    L31,
    L32,
    L33,
    L34,
    L35,
    L36,
    L37,
    L38,
    L39,
    L40,
    LNO)
    Heres a sample of the data
    UNB+UNOA:2+5398888501357+5398888501838+080306:0737+395+ DESADV+++1'UNH+0001+DESADV:D:93A:UN:EAN004'

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6020061915147
    answers this question perfectly

  • SQL*Loader and multiple files

    Hello, am tasked with loading tables with 21+ million rows. Will SQL*Loader perform better with one large file or many smaller files? Is there any ideal file size for optimal performance? Thank you
    David

    Don, when I tried to loada 21M row table using direct, I get the following messages:
    Record 2373: Rejected - Error on table STAGE_CUSTOMER.
    ORA-03113: end-of-file on communication channel
    SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed
    Here is the SQL*Loader log:
    SQL*Loader: Release 9.2.0.1.0 - Production on Thu Apr 26 15:38:29 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Control File: stage_customer.ctl
    Character Set UTF8 specified for all input.
    First primary datafile stage_Customer_20070301.csv has a
    utf8 byte order mark in it.
    Data File: stage_Customer_20070301.csv
    Bad File: stage_Customer_20070301.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 1000
    Continuation: none specified
    Path used: Direct
    Silent options: FEEDBACK
    Table STAGE_CUSTOMER, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    ROW_ID SEQUENCE (MAX, 1)
    CUSTOMER_ACCT_NUM FIRST * , O(") CHARACTER
    IS_DELETED NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:Is_Deleted) IN ('FALSE','0') THEN 0 ELSE 1 END"
    NAME_PREFIX NEXT * , O(") CHARACTER
    FIRST_NAME NEXT * , O(") CHARACTER
    MIDDLE_NAME NEXT * , O(") CHARACTER
    LAST_NAME NEXT * , O(") CHARACTER
    NAME_SUFFIX NEXT * , O(") CHARACTER
    NICK_NAME NEXT * , O(") CHARACTER
    ALT_FIRST_NAME NEXT * , O(") CHARACTER
    ALT_LAST_NAME NEXT * , O(") CHARACTER
    MARKETING_SOURCE_ID NEXT * , O(") CHARACTER
    HOME_PHONE NEXT * , O(") CHARACTER
    WORK_PHONE NEXT * , O(") CHARACTER
    MOBILE_PHONE NEXT * , O(") CHARACTER
    ALTERNATE_PHONE NEXT * , O(") CHARACTER
    EMAIL_ADDR NEXT * , O(") CHARACTER
    ALT_EMAIL_ADDR NEXT * , O(") CHARACTER
    BIRTH_DATE NEXT * , O(") CHARACTER
    SQL string for column : "TRUNC(TO_DATE(:Birth_Date, 'MM/DD/YYYY HH24:MI:SS'))"
    SALES_CHANNEL_ID NEXT * , O(") CHARACTER
    SQL string for column : "decode(:Sales_Channel_id,NULL,NULL,NULL)"
    ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
    ALT_ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
    UPDATE_LOCATION_CD NEXT * , O(") CHARACTER
    UPDATE_DATE NEXT * , O(") CHARACTER
    SQL string for column : "TRUNC(TO_DATE(:Update_Date, 'MM/DD/YYYY HH24:MI:SS'))"
    CUSTOMER_LOGIN_NAME NEXT * , O(") CHARACTER
    DISCOUNT_CD NEXT * , O(") CHARACTER
    DISCOUNT_PERCENT NEXT * , O(") CHARACTER
    BUSINESS_NAME NEXT * , O(") CHARACTER
    POS_TAX_FLAG NEXT * , O(") CHARACTER
    POS_TAX_PROMPT NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_TAX_PROMPT) IN ('FALSE','0') THEN 0 ELSE 1 END"
    POS_DEFAULT_TAX_ID NEXT * , O(") CHARACTER
    POS_TAX_ID_EXPIRATION_DATE NEXT * , O(") CHARACTER
    POS_AUTHORIZED_USER_FLAG NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_AUTHORIZED_USER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
    POS_ALLOW_PURCHASE_ORDER_FLAG NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_ALLOW_PURCHASE_ORDER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ADDRESS1 NEXT * , O(") CHARACTER
    ADDRESS2 NEXT * , O(") CHARACTER
    ADDRESS3 NEXT * , O(") CHARACTER
    CITY NEXT * , O(") CHARACTER
    STATE_CD NEXT * , O(") CHARACTER
    POSTAL_CD NEXT * , O(") CHARACTER
    COUNTRY_CD NEXT * , O(") CHARACTER
    ALLOW_UPDATE NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:ALLOW_UPDATE) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ACTION_CODE NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:action_code) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ACCOUNT_TYPE_ID NEXT * , O(") CHARACTER
    LOCALE_CD NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN :Locale_CD IS NOT NULL AND :Locale_CD LIKE '__-__' THEN :Locale_CD ELSE 'en-US' END"
    IS_READY_FOR_PROCESSING CONSTANT
    Value is '1'
    IS_BUSINESS CONSTANT
    Value is '0'
    HAD_ERRORS CONSTANT
    Value is '0'
    Record 2373: Rejected - Error on table STAGE_CUSTOMER.
    ORA-03113: end-of-file on communication channel
    SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed
    Table STAGE_CUSTOMER:
    0 Rows successfully loaded.
    1 Row not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Bind array size not used in direct path.
    Column array rows : 5000
    Stream buffer bytes: 256000
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 3469
    Total logical records rejected: 1
    Total logical records discarded: 0
    Direct path multithreading optimization is disabled
    Run began on Thu Apr 26 15:38:29 2007
    Run ended on Thu Apr 26 15:38:30 2007
    Elapsed time was: 00:00:01.18
    CPU time was: 00:00:00.32

  • SQL LOADER LPAD CONTROL FILE QUESTION

    Hi, inthe flat file
    company_cd is "1" or "01"
    and center_cd is 3 digits... ex: "493"
    in the table the userid coulmn should be 6 digits
    currently i am getting this as userid in the table
    "010493" is right, because company_cd is "01"
    "10493" is not right, because company_cd is "1"
    if company_cd is 2 digits(01) i am getting 6 digits userid which is OK
    but when company_cd is singile digit(1) i am getting 5 digits userid
    I NEED TO LPAD with 0 in the front when company_cd is "1"any suggetions ???????
    ***********This is the code i am using currently in the CTL file for userid**********
    ,USERID "CONCAT(substr(trim(:company_cd),1,2),lpad(trim(:center_cd),4,0))"
    .......Thank You..........
    Edited by: phani_Marella on Aug 28, 2012 11:12 AM

    Now where does company 'coz' come from all of a sudden?
    I'm sure you read {message:id=9360002} , hence my confusion.
    Anyway, the SQL*Loader forum is @ Export/Import/SQL Loader & External Tables

  • Sql*loader and sequence() for primary keys

    I have a question regarding SQL*Loader with the sequence() function and using it for a primary key to load records in multiple tables from one input record. I am pulling data from a delimited file and populating several tables from each row. For the primary key, I am using the sequence function.
    For the first table (the parent), I use sequence(40000,1) for the key. Since the remaining inserts are based on the same logical record, I use sequence(40000,1) for those too (one record for each month). The problem comes in when a child record does not pass a WHEN clause (the amount is zero). Then it almost seems as if the parent record is not loaded and the child (or children) that does pass the WHEN clause are assigned to the next parent! Obviously, the sequence is getting out of sync between the children and the parent.
    I've looked in the documentation and tried several different ways to attack this problem. Is there a bug in SQLLDR (8.1.7) or is it just my coding.
    I will try to include the files below but they are very large.
    Thanks for your help.
    Dan
    ***CONTROL FILE***
    LOAD DATA
    INFILE 'rent.csv'
    INTO TABLE BUDGET_LINE
    append
    WHEN TOT_AMT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER CHAR,
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    JUL_AMT          FILLER CHAR,
    JUL_CNT          FILLER CHAR,
    AUG_AMT          FILLER CHAR,
    AUG_CNT          FILLER CHAR,
    SEP_AMT          FILLER CHAR,
    SEP_CNT          FILLER CHAR,
    OCT_AMT          FILLER CHAR,
    OCT_CNT          FILLER CHAR,
    NOV_AMT          FILLER CHAR,
    NOV_CNT          FILLER CHAR,
    DEC_AMT          FILLER CHAR,
    DEC_CNT          FILLER CHAR,
    CUT               FILLER CHAR,
    NETMANGEN          FILLER CHAR,
    NETMAN_item          BOUNDFILLER CHAR,
    NETMAN_item_seq     BOUNDFILLER CHAR,
    NETMAN_location     BOUNDFILLER CHAR,
    UPDATED_ON          DATE "MM/DD/YYYY",
    NETMAN_com_desc     BOUNDFILLER CHAR,
    NETMAN_vendor          BOUNDFILLER CHAR,
    NETMAN_generation     BOUNDFILLER CHAR,
    CREATED_ON          SYSDATE,
    CREATED_BY          CONSTANT '0',
    UPDATED_BY          CONSTANT '0',
    ACTIVE          CONSTANT 'T',
    GL_CODE_COMBO_ID     CONSTANT '0',
    BUDGET_TYPE          CONSTANT 'B',
    AMOUNT_TYPE          CONSTANT 'D',
    source          constant 'N',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    DESCRIPTION          "(:NETMAN_item)||'-'||(:NETMAN_item_seq)||'; '||:NETMAN_com_desc||'; '||:NETMAN_vendor||' ('||:NETMAN_generation||')'"
    INTO TABLE GL_CODE_TEMP
    append
    WHEN TOT_AMT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    SPENDER          CHAR ,
    ACCT               CHAR ,
    TOT_AMT          FILLER CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '1',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '2',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '3',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '4',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '5',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '6',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '7',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '8',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    JUL_AMT          FILLER CHAR,
    JUL_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '9',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    JUL_AMT          FILLER CHAR,
    JUL_CNT          FILLER CHAR,
    AUG_AMT          FILLER CHAR,
    AUG_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '10',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    JUL_AMT          FILLER CHAR,
    JUL_CNT          FILLER CHAR,
    AUG_AMT          FILLER CHAR,
    AUG_CNT          FILLER CHAR,
    SEP_AMT          FILLER CHAR,
    SEP_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '11',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    JUL_AMT          FILLER CHAR,
    JUL_CNT          FILLER CHAR,
    AUG_AMT          FILLER CHAR,
    AUG_CNT          FILLER CHAR,
    SEP_AMT          FILLER CHAR,
    SEP_CNT          FILLER CHAR,
    OCT_AMT          FILLER CHAR,
    OCT_CNT          FILLER CHAR,
    AMOUNT          CHAR
    INTO TABLE BUDGET_COST
    append
    WHEN AMOUNT != '0'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    NETMAN_ITEM_NO      FILLER POSITION(1) CHAR TERMINATED BY ',',
    BUDGET_LINE_ID     SEQUENCE(40000,1),
    PERIOD_ID          CONSTANT '12',
    SPEND               FILLER CHAR,
    ACCOUNT          FILLER CHAR,
    TOT_AMT          FILLER CHAR,
    JAN_AMT          FILLER CHAR,
    JAN_CNT          FILLER CHAR,
    FEB_AMT          FILLER CHAR,
    FEB_CNT          FILLER CHAR,
    MAR_AMT          FILLER CHAR,
    MAR_CNT          FILLER CHAR,
    APR_AMT          FILLER CHAR,
    APR_CNT          FILLER CHAR,
    MAY_AMT          FILLER CHAR,
    MAY_CNT          FILLER CHAR,
    JUN_AMT          FILLER CHAR,
    JUN_CNT          FILLER CHAR,
    JUL_AMT          FILLER CHAR,
    JUL_CNT          FILLER CHAR,
    AUG_AMT          FILLER CHAR,
    AUG_CNT          FILLER CHAR,
    SEP_AMT          FILLER CHAR,
    SEP_CNT          FILLER CHAR,
    OCT_AMT          FILLER CHAR,
    OCT_CNT          FILLER CHAR,
    NOV_AMT          FILLER CHAR,
    NOV_CNT          FILLER CHAR,
    AMOUNT          CHAR
    *** PIECE OF DATA FILE ***
    Item,Spender,Account,Total Amt,Jan Amt,Jan Count,Feb Amt,Feb Count,Mar Amt,Mar Count,Apr Amt,Apr Count,May Amt,May Count,Jun Amt,Jun Count,Jul Amt,Jul Count,Aug Amt,Aug Count,Sep Amt,Sep Count,Oct Amt,Oct Count,Nov Amt,Nov Count,Dec Amt,Dec Count,Status,Netman Gen,Netman Item,Netman Unit,Location,Last Update Date,Component Description,Vendor Description,Generation Process
    10110993,10993,8301-01,90134,7480,0,7480,0,7480,0,7480,0,7480,0,7480,0,7480,0,7480,0,7480,0,7480,0,7667,0,7667,0,0,+,LEASE PYMT,207,WIMOS,5/22/2002,LEASE PAYMENTS,"VIKING HOLDING, INC.",ACTUAL BUDGET
    10410993,10993,8301-04,15240,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,1270,0,0,+,JANITORIAL,58,WIMOS,5/22/2002,JANITORIAL,BUILDING ONE SVC SOLUTION,ACTUAL BUDGET
    10810993,10993,8301-08,2232,186,0,186,0,186,0,186,0,186,0,186,0,186,0,186,0,186,0,186,0,186,0,186,0,0,+,ELECTRIC,77,WIMOS,5/22/2002,"UTILITIES (GAS,ELEC.,ETC)",WISCONSIN PUBLIC SERVICE,AVGD 01 04 07 10 NOT WEIGHTED
    10910993,10993,8301-09,4220,26,0,348,0,609,0,383,0,348,0,371,0,348,0,371,0,360,0,348,0,360,0,348,0,0,+,FIRE EQUIP,51,WIMOS,5/22/2002,RENT CONTRACT SERVICES,"CENTRALCOM, INC.",ACTUAL EXPERIENCE
    11610993,10993,8301-16,1272,106,0,106,0,106,0,106,0,106,0,106,0,106,0,106,0,106,0,106,0,106,0,106,0,0,+,L/H MOSINE,1,WIMOS,5/22/2002,LEASEHOLD IMPROVEMENTS,ELLIS STONE,ACTUAL BUDGET
    10110994,10994,8301-01,69960,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,5830,0,0,+,LEASE PYMT,228,WISTEWEL,5/22/2002,LEASE PAYMENTS,BJ INVESTMENTS LLC,ACTUAL BUDGET
    10410994,10994,8301-04,840,70,0,70,0,70,0,70,0,70,0,70,0,70,0,70,0,70,0,70,0,70,0,70,0,0,+,JANITORIAL,69,WISTEWEL,5/22/2002,JANITORIAL,MARSDEN,ACTUAL BUDGET
    10710994,10994,8301-07,6067,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6067,0,0,+,LEASE PYMT,228,WISTEWEL,5/22/2002,LEASE PAYMENTS,BJ INVESTMENTS LLC,ASSUME 5% INCREASE OVER ACTUAL 2000 EXPENSES
    10810994,10994,8301-08,2460,205,0,205,0,205,0,205,0,205,0,205,0,205,0,205,0,205,0,205,0,205,0,205,0,0,+,ELECTRIC,84,WISTEWEL,5/22/2002,"UTILITIES (GAS,ELEC.,ETC)",BJ INVESTMENTS LLC,AVGD 03 06 09 NOT WEIGHTED
    10910994,10994,8301-09,1050,70,0,70,0,105,0,105,0,70,0,105,0,35,0,140,0,35,0,70,0,210,0,35,0,0,+,SANITATION,12,WISTEWEL,5/22/2002,RENT CONTRACT SERVICES,WASTE MANAGEMENT OF WIS,ACTUAL EXPERIENCE
    11910994,10994,8301-19,1099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1099,0,0,0,0,0,0,0,0,0,0,+,INSURANCE,6,WISTEWEL,5/22/2002,INSURANCE,BJ INVESTMENTS LLC,ACTUAL EXPERIENCE
    10110998,10998,8301-01,2440,2440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+,LEASE PYMT,47,ILELG,5/22/2002,LEASE PAYMENTS,ELGIN AIRPORT BUSINESS PK,ACTUAL BUDGET
    10410998,10998,8301-04,146,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+,LEASE PYMT,47,ILELG,5/22/2002,LEASE PAYMENTS,ELGIN AIRPORT BUSINESS PK,ACTUAL BUDGET
    10610998,10998,8301-06,336,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,0,+,DRINK H2O,46,ILELG,5/22/2002,COOLER AND BOTTLED WATER,"HINCKLEY & SCHMITT, INC.",AVGD 01 02 03 04 05 06 07 08 09 10
    10710998,10998,8301-07,276,276,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,+,LEASE PYMT,47,ILELG,5/22/2002,LEASE PAYMENTS,ELGIN AIRPORT BUSINESS PK,ASSUME 5% INCREASE OVER ACTUAL 2000 EXPENSES
    10810998,10998,8301-08,3108,433,0,315,0,234,0,173,0,181,0,292,0,320,0,337,0,316,0,153,0,183,0,171,0,0,+,ELECTRIC,20,ILELG,5/22/2002,"UTILITIES (GAS,ELEC.,ETC)",COMMONWEALTH EDISON,AVGD 01 02 03 04 05 06 07 08 09 10 WEIGHTED
    *** SCRIPT FOR TABLES LOADED ***
    CREATE TABLE BUDGET_LINE (
    BUDGET_LINE_ID NUMBER NOT NULL,
    BUDGET_TYPE CHAR (1) NOT NULL,
    GL_CODE_COMBO_ID NUMBER NOT NULL,
    AMOUNT_TYPE CHAR (1) NOT NULL,
    ACTIVE CHAR (1) DEFAULT 'T' NOT NULL,
    SOURCE CHAR (1),
    CUT CHAR (1),
    DESCRIPTION VARCHAR2 (180),
    CAP_ITEM_ID NUMBER,
    PBT_ID NUMBER,
    BILL_ID NUMBER,
    CREATED_ON DATE DEFAULT SYSDATE NOT NULL,
    CREATED_BY NUMBER NOT NULL,
    UPDATED_ON DATE DEFAULT SYSDATE NOT NULL,
    UPDATED_BY NUMBER NOT NULL,
    CHECK (ACTIVE IN ('T','F') ) ,
    CHECK (CUT IN ('C',NULL) ),
    CONSTRAINT BUDGET_LINE_PRI
    PRIMARY KEY ( BUDGET_LINE_ID ) ) ;
    CREATE TABLE BUDGET_COST (
    BUDGET_LINE_ID NUMBER NOT NULL,
    PERIOD_ID NUMBER NOT NULL,
    AMOUNT NUMBER (13,2),
    CONSTRAINT BUDGET_COST_PRI
    PRIMARY KEY ( BUDGET_LINE_ID, PERIOD_ID ) ) ;
    CREATE TABLE GL_CODE_TEMP (
    BUDGET_LINE_ID NUMBER NOT NULL,
    SPENDER CHAR (5),
    ACCT CHAR (7),
    GL_CODE_COMBO_ID NUMBER,
    CONSTRAINT GL_CODE_TEMP_BDGT_ID
    PRIMARY KEY ( BUDGET_LINE_ID ) ) ;

    Thanks for the reply .. user do have their user credentials but only for the application ... but all users use a common loader and control file once they log into the application. So irrespective of which user is logged in he selects the same control file and loads to the same table mentioned in the control file .. i instead want user to be able to load to the table in control file but into his schema like username.tablename instead of just the tablename mentioned in .ctl file.

  • Load data with SQL Loader link field between CSV file and Control File

    Hi all,
    in a SQL Loader control file, how do you specify link with field in CSV file and Control file?
    E.g. if I wat to import the record in table TEST (col1, col2, col3) with data in csv file BUT in different position. How to do this?
    FILE CSV (with variable position):
    test1;prova;pippo;Ferrari;
    xx;yy;hello;by;
    In the table TEST i want that col1 = 'prova' (xx),
    col2 = 'Ferrari' (yy)
    col3 = default N
    the others data in CSV file are ignored.
    so:
    load data
    infile 'TEST.CSV'
    into table TEST
    fields terminated by ';'
    col1 ?????,
    col2 ?????,
    col3 CONSTANT "N"
    Thanks,
    Attilio

    With '?' mark i mean " How i can link this COL1 with column in csv file ? "
    Attilio

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

  • SQL Loader and Insert Into Performance Difference

    Hello All,
    Im in a situation to measure performance difference between SQL Loader and Insert into. Say there 10000 records in a flat file and I want to load it into a staging table.
    I know that if I use PL/SQL UTL_FILE to do this job performance will degrade(dont ask me why im going for UTL_FILE instead of SQL Loader). But I dont know how much. Can anybody tell me the performance difference in % (like 20% will decrease) in case of 10000 records.
    Thanks,
    Kannan.

    Kannan B wrote:
    Do not confuse the topic, as I told im not going to use External tables. This post is to speak the performance difference between SQL Loader and Simple Insert Statement.I don't think people are confusing the topic.
    External tables are a superior means of reading a file as it doesn't require any command line calls or external control files to be set up. All that is needed is a single external table definition created in a similar way to creating any other table (just with the additional external table information obviously). It also eliminates the need to have a 'staging' table on the database to load the data into as the data can just be queried as needed directly from the file, and if the file changes, so does the data seen through the external table automatically without the need to re-run any SQL*Loader process again.
    Who told you not to use External Tables? Do they know what they are talking about? Can they give a valid reason why external tables are not to be used?
    IMO, if you're considering SQL*Loader, you should be considering External tables as a better alternative.

  • Sql Loader and a batch id

    Hello
    I have a loading table which as a primary key. We insert into load_ctl table which has a load_ctl_id and then sql load a csv file into a table called load_table.
    Now when we have to process the load_table we work with the primary key from the control table load_ctl_id to know which load to process. How can I get the load_ctl_id into my load_table. The csv file does not contain it.

    What full version of Oracle?
    How do you currently generate the control table load_ctl_id?
    Do you have to be concerned with concurrent load jobs?
    What tool are you using to perform the load (sqlldr)?
    If you already have a way of gerating the load_ctl_id and placing it into the control table and you do not need to worry about concurrent jobs you could use a before insert trigger to insert the same maximum load_ctl_id (assuming sequence or date stamp) into the load table with each row insert. Or leave the column null during the load and then immediately after the load update each column.
    If you have to worry about concurrent load processes where each would be a different batch number then how you currently create the load_ctl_id value is more important to the solution since you have to make sure two concurrently running sessions would in fact grap two different batch ids.
    HTH -- Mark D Powell --

  • Sql loader maximum data file size..?

    Hi - I wrote sql loader script runs through shell script which will import data into table from CSV file. CSV file size is around 700MB. I am using Oracle 10g with Sun Solaris 5 environment.
    My question is, is there any maximum data file size. The following code from my shell script.
    SQLLDR=
    DB_USER=
    DB_PASS=
    DB_SID=
    controlFile=
    dataFile=
    logFileName=
    badFile=
    ${SQLLDR} userid=$DB_USER"/"$DB_PASS"@"$DB_SID \
              control=$controlFile \
              data=$dataFile \
              log=$logFileName \
              bad=$badFile \
              direct=true \
              silent=all \
              errors=5000Here is my control file code
    LOAD DATA
    APPEND
    INTO TABLE KEY_HISTORY_TBL
    WHEN OLD_KEY <> ''
    AND NEW_KEY <> ''
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
            OLD_KEY "LTRIM(RTRIM(:OLD_KEY))",
            NEW_KEY "LTRIM(RTRIM(:NEW_KEY))",
            SYS_DATE "SYSTIMESTAMP",
            STATUS CONSTANT 'C'
    )Thanks,
    -Soma
    Edited by: user4587490 on Jun 15, 2011 10:17 AM
    Edited by: user4587490 on Jun 15, 2011 11:16 AM

    Hello Soma.
    How many records exist in your 700 MB CSV file? How many do you expect to process in 10 minutes? You may want to consider performing a set of simple unit tests with 1) 1 record, 2) 1,000 records, 3) 100 MB filesize, etc. to #1 validate that your shell script and control file syntax function as expected (including the writing of log files, etc.), and #2 gauge how long the processing will take for the full file.
    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.

  • Is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader

    Hi
    Can anyone tell me whether is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader?
    I am upgrading the 9i db to 10g and wanted to run the 9i SQL Loader control files on upgraded 10g db. So please let me know is there any difference which I need to consider any modifications in the control files..
    Thank you in advance
    Adi

    answered

  • Unable to load Site Control File

    Hello,
    The background :
    I am in the process of learning how to create a Management Pack for a distributed application in SCOM 2012 R2.</p><p>For this, I picked our SCCM Site server to use as an example. So, in short, am writing a management pack for SCCM 2007 Discovery.
    I know a management pack might already exist. I am trying to learn by using an architecture I'm familiar with so I need to create this from scratch.
    In order to discover SCCM Site installed on a server, I decided to use the SMS WMI namespace. By reading the
    SMS_ProviderLocation Instance, I am able to detect if the server has SCCM Site installed on it.
    My next step was to find out where the SMS database is hosted. I found
    ROOT\SMS\site_ABC\ namespace contains an instance of SMS_SCI_SiteDefinition where I can find the database name and server name which I can use to discover the other components of a distributed application.
    The problem :
    When I run the query Select * from SMS_SCI_SiteDefinition I get a generic error 0x80041001.
    More Information reveals the following:
    error description : " Unable to load site control file "
    error code : " 2160198400 (0x80c20300) "
    file name : " c:\qfe\nts_sms_fre\sms\siteserver\sdk_provider\smsprov\sspsitecontrolextractor.cpp "
    Now, I cannot find the QFE folder anywhere. The SCCM Site is working fine and the site_control_manager component has no errors. I can launch the SCCM console on that server without any errors and the site status messages do not contain any errors.
    Can someone please help me out with "detecting" an installed instance of SCCM site server using WMI? Is the above error cause for worry for the SCCM part of my brain?
    Thanks in advance for your guidance!

    Thanks for your response Don!
    The SMS_Site instance does not provide information of the database server and database name.
    The funny thing is when I browse use wbemtest to connect to root\SMS\site_XXX and enumerate classes, i do not find
    the SMS_SCI_SiteDefinition. 
    I find it when i enumerate recursively and can browse into the values. I'm not sure how could build a query against this now.
    Can anybody with a test instance of SCCM 2007 check this and let me know please?
    Everything you are looking for exist within WMI. You can use the documentation script as an example to get what you are looking for.
    http://www.enhansoft.com/pages/downloads.aspx
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

Maybe you are looking for

  • Select Statement to Get Unique values in a Column

    I am trying to figure out how to get all the unique values from a table column? select code from atable sort unique? I am running 8.1.7 Does anyone know how to do this? Thanks,

  • Using the Macbook with new LED Apple Cinema Display? Not a beginner's Q...

    Hi - I'm sort of cross-posting this because I'm not getting any answers in the Apple Cinema Display Forum, so here goes. So far, no one - not even a tech guy at a local Apple Reseller - has been able to help, so I've got my fingers crossed. I just go

  • Iphoto won't email or export

    I choose my pictures click email, choose my options, it says "preparing photos for email", then nothing. No email opens with the attached pics. So I try to export the pictures and manually add them to an email. I chose file, export, choose jpeg forma

  • Reg Hierarchy

    I have a Query with hierarchy. I have used the hierarchy nodes in my structure elements. When I check the query, it doesnt give any messages, but when I execute the query in analyzer, it says (warning) that one Hierarchy node is missing, but I could

  • Re : Business transaction category & Leading transaction category

    Hi All, if any one could differentiate between Business transaction category and leading transaction category, kindly give examples.I understood there is two business transaciton category( sales & business activity) for Standard sales order, please e