SQL*Loader and DECODE function

Hi All,
I am loading data from data files into oracle tables and while loading the data using SQL*Loader, the following requirement needs to be fulfilled.
1) If OQPR < 300, RB = $ 0-299, SC = "SC1"
2) If 300 < OQPR < 1200, RB = $ 300-1199, SC = "SC2"
3) If 1200 < OQPR < 3000, RB = $ 1200-2999, SC = "SC3"
4) If OQPR > 3000 USD, RB = > $3000, SC = "SC4"
Here OPQR is a field in the data file.
Can anyone suggest how do we handle this using DECODE function? Triggers and PL/SQL functions are not to be used.
TIA.
Regards,
Ravi.

The following expression gives you different values for your different intervals and boundaries :
SIGN(:OQPR - 300) + SIGN(:OQPR - 1200) + SIGN(:OQPR - 3000)

Similar Messages

  • SQL*LOADER and decode

    I'm setting up a sql*loader script and trying to use the decode function as referred to in 'Applying SQL Operators to Fields' I'm getting an error message ' Token longer than max allowable length of 258 chars'. Is there a limit to the size of the decode statement within sql*loader - or is it better to use a table trigger to handle this on insert? I ran the decode statement as a select through SQL*Plus and it works okay there. Oracle 8.0 Utilities shows example of decode in Ch. 5, but Oracle 9i Utilities Ch. 6 does not. Has anyone done this and what's the impact on performance of the load if I can get it to work? See my example below:
    LOAD DATA
    INFILE 'e2e_prod_cust_profile.csv'
    APPEND
    INTO TABLE APPS.RA_CUSTOMER_PROFILES_INTERFACE
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    (Insert_update_flag CHAR(1),
    Orig_system_customer_ref CHAR(240),
    customer_profile_class_name CHAR(30) NULLIF customer_profile_class=BLANKS
    "decode(customer_profile_class_name,
    'NORTHLAND Default','(MIA) Default',
    'NORTHLAND Non Consolidated','(MIA) Non Cons',
    'NORTHLAND Consolidated A','(MIA) Cons A',
    'NORTHLAND Consolidated B','(MIA) Cons B',
    'NORTHLAND Consolidated C','(MIA) Cons C',
    'NORTHLAND Consolidated D','(MIA) Cons D',
    'NORTHLAND Cons A NonZS','(MIA) Cons A NonZS',
    'NORTHLAND Cons B NonZS','(MIA) Cons B NonZS',
    'NORTHLAND Cons C NonZS','(MIA) Cons C NonZS',
    'NORTHLAND Cons D NonZS','(MIA) Cons D NonZS',
    'NORTHLAND International Billing','(MIA) International Billing',
    customer_profile_class_name)",
    credit_hold CHAR(1),
    overall_credit_limit INTERGER EXTERNAL,
    "e2e_cust_profile.ctl" 49 lines, 1855 characters
    SQL*Loader-350: Syntax error at line 15.
    Token longer than max allowable length of 258 chars
    'NORTHLAND Consolidated D','(MIA) Cons D',
    ^

    Your controlfile is incomplete and has some typos, but you could try something like:
    create or replace function decode_profile_class_name (p_longname IN VARCHAR2)
    return VARCHAR2
    is
    begin
      CASE p_longname
        WHEN 'NORTHLAND Default'               THEN RETURN '(MIA) Default';
        WHEN 'NORTHLAND Non Consolidated'      THEN RETURN '(MIA) Non Cons';
        WHEN 'NORTHLAND Consolidated A'        THEN RETURN '(MIA) Cons A';
        WHEN 'NORTHLAND Consolidated B'        THEN RETURN '(MIA) Cons B';
        WHEN 'NORTHLAND Consolidated C'        THEN RETURN '(MIA) Cons C';
        WHEN 'NORTHLAND Consolidated D'        THEN RETURN '(MIA) Cons D';
        WHEN 'NORTHLAND Cons A NonZS'          THEN RETURN '(MIA) Cons A NonZS';
        WHEN 'NORTHLAND Cons B NonZS'          THEN RETURN '(MIA) Cons B NonZS';
        WHEN 'NORTHLAND Cons C NonZS'          THEN RETURN '(MIA) Cons C NonZS';
        WHEN 'NORTHLAND Cons D NonZS'          THEN RETURN '(MIA) Cons D NonZS';
        WHEN 'NORTHLAND International Billing' THEN RETURN '(MIA) International Billing';
        ELSE RETURN p_longname;
      END CASE;
    end;
    LOAD DATA
    INFILE 'e2e_prod_cust_profile.csv'
    APPEND
    INTO TABLE APPS.RA_CUSTOMER_PROFILES_INTERFACE
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    Insert_update_flag          CHAR(1),
    Orig_system_customer_ref    CHAR(240),
    customer_profile_class_name CHAR(30) NULLIF customer_profile_class=BLANKS "decode_profile_class_name(:customer_profile_class_name)"
    credit_hold                 CHAR(1),
    overall_credit_limit        INTEGER EXTERNAL

  • SQL Loader : Trim and Decode functions help please

    Hi,
    I have to load data from a flat file, for some columns i need to use TRIM and DECODE functions.It is a pipe delimited file.
    I get syntax errors (one is below) same error listed for TRIM.
    SQL*Loader-350: Syntax error at line xx.
    Expecting "," or ")", found "DECODE".
    ===========
    ,FINAL_BILL_DATE CHAR(30) "TRIM(:FINAL_BILL_DATE)"
    ,BUSINESS_ID "DECODE(:BUSINESS_ID,'B',1,'C',2,'E',3,'G',4,'O',5,'R',6,'T',7,'U',8,'H',9,-1)"
    Can anyone please help.
    Thanks
    Cherrish

    Hello Cherrish.
    The error you are receiving leads me to believe that at some point prior to the DECODE on the line for BUSINESS_ID, probably some line even before the FINAL_BILL_DATE line, there a syntactical error causing the quotes before the DECODE to actually terminate some other syntax. Without all of the lines that could actually contribute to this, including the header details, this is the best I can advise.
    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 create table and insert table statements to help the forum members help you better.

  • SQL Expression in decode function or case statement?

    Can I put SQL expressions in decode function or case statement?
    For example,
    select le.profile, decode( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile, 0, 'N', 'Y')
    from element le;
    or
    select le.profile, case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0 THEN 'N'
    ELSE 'Y'
    from element le;
    None of the above work.
    Can anyone tell me how to make it work?
    Is there any workaround?
    Thanks,
    J

    You simply needed and END to your CASE statement;
    SQL> with profile_data as (
       select 'XXXX_AFTER' name, 1 object_id from dual),
         element as (
       select 1 profile from dual union all
       select 2 from dual)
    select le.profile,
       case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0
       THEN 'N'
       ELSE 'Y'
       END new_col
    from element le
       PROFILE N
             1 Y
             2 N

  • Case statement and Decode function both are not working in Select cursor.

    I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. On the other hand both the things work in just select statement.
    See the first column in select (PAR_FLAG), I need to have this evaluated along with other fields. Can you please suggest some thing to make this work. And also I would like to
    know the reason why decode is not working, I heard some where Case statement do not work with 8i.
    Author : Amit Juneja
    Date : 06/20/2011
    Description:
    Updates the Diamond MEMBER_MASTER table with the values from
    INC.MEM_NJ_HN_MEMBER_XREF table.
    declare
    rec_cnt number(12) := 0;
    commit_cnt number(4) := 0;
    cursor select_cur is
    Select DECODE(1,
    (Select 1
    from hsd_prov_contract R
    where R.seq_prov_id = PM.seq_prov_id
    and R.line_of_business = H.line_of_business
    and R.PCP_FLAG = 'Y'
    and R.participation_flag = 'P'
    and SYSDATE between R.EFFECTIVE_DATE AND
    NVL(R.TERM_DATE,
    TO_DATE('31-DEC-9999', 'DD-MON-YYYY'))),
    'Y',
    'N') PAR_FLAG,
    H.SEQ_ELIG_HIST,
    H.SEQ_MEMB_ID,
    H.SEQ_SUBS_ID,
    H.SUBSCRIBER_ID,
    H.PERSON_NUMBER,
    H.EFFECTIVE_DATE,
    H.TERM_DATE,
    H.TERM_REASON,
    H.RELATIONSHIP_CODE,
    H.SEQ_GROUP_ID,
    H.PLAN_CODE,
    H.LINE_OF_BUSINESS,
    H.RIDER_CODE_1,
    H.RIDER_CODE_2,
    H.RIDER_CODE_3,
    H.RIDER_CODE_4,
    H.RIDER_CODE_5,
    H.RIDER_CODE_6,
    H.RIDER_CODE_7,
    H.RIDER_CODE_8,
    H.MEDICARE_STATUS_FLG,
    H.OTHER_STATUS_FLAG,
    H.HIRE_DATE,
    H.ELIG_STATUS,
    H.PREM_OVERRIDE_STEP,
    H.PREM_OVERRIDE_AMT,
    H.PREM_OVERRIDE_CODE,
    H.SEQ_PROV_ID,
    H.IPA_ID,
    H.PANEL_ID,
    H.SEQ_PROV_2_ID,
    H.SECURITY_CODE,
    H.INSERT_DATETIME,
    H.INSERT_USER,
    H.INSERT_PROCESS,
    H.UPDATE_DATETIME,
    H.UPDATE_USER,
    H.UPDATE_PROCESS,
    H.USER_DEFINED_1,
    H.SALARY,
    H.PEC_END_DATE,
    H.REASON_CODE,
    H.PEC_WAIVED,
    H.BILL_EFFECTIVE_FROM_DATE,
    H.BILLED_THRU_DATE,
    H.PAID_THRU_DATE,
    H.SUBSC_DEPT,
    H.SUBSC_LOCATION,
    H.USE_EFT_FLG,
    H.BENEFIT_START_DATE,
    H.SEQ_ENROLLMENT_RULE,
    H.MCARE_RISK_ACCRETION_DATE,
    H.MCARE_RISK_DELETION_DATE,
    H.MCARE_RISK_REFUSED_DATE,
    H.COMMENTS,
    H.USER_DEFINED_2,
    H.USER_DEFINED_3,
    H.RATE_TYPE,
    H.PCPAA_OCCURRED,
    H.PRIVACY_ON,
    H.PCP_CHANGE_REASON,
    H.SITE_CODE,
    H.SEQ_SITE_ADDRESS_ID,
    PM.seq_prov_id rendered_prov
    from hsd_member_elig_history H,
    INC.PCP_REASSIGN_RPRT_DATA P,
    hsd_prov_master PM
    where P.subscriber_id = H.subscriber_id
    and P.rendered_pcp = PM.provider_ID
    and H.elig_status = 'Y'
    and (H.term_date is NULL or H.term_date >= last_day(sysdate))
    order by H.Seq_memb_id;
    begin
    for C in select_cur loop
    rec_cnt := rec_cnt + 1;
    update hsd_member_elig_history
    set term_date = TRUNC(SYSDATE - 1),
    term_reason = 'PCPTR',
    update_datetime = SYSDATE,
    update_user = USER,
    update_process = 'TD33615'
    where seq_elig_hist = C.seq_elig_hist
    and seq_memb_id = C.seq_memb_id;
    INSERT INTO HSD_MEMBER_ELIG_HISTORY
    (SEQ_ELIG_HIST,
    SEQ_MEMB_ID,
    SEQ_SUBS_ID,
    SUBSCRIBER_ID,
    PERSON_NUMBER,
    EFFECTIVE_DATE,
    TERM_DATE,
    TERM_REASON,
    RELATIONSHIP_CODE,
    SEQ_GROUP_ID,
    PLAN_CODE,
    LINE_OF_BUSINESS,
    RIDER_CODE_1,
    RIDER_CODE_2,
    RIDER_CODE_3,
    RIDER_CODE_4,
    RIDER_CODE_5,
    RIDER_CODE_6,
    RIDER_CODE_7,
    RIDER_CODE_8,
    MEDICARE_STATUS_FLG,
    OTHER_STATUS_FLAG,
    HIRE_DATE,
    ELIG_STATUS,
    PREM_OVERRIDE_STEP,
    PREM_OVERRIDE_AMT,
    PREM_OVERRIDE_CODE,
    SEQ_PROV_ID,
    IPA_ID,
    PANEL_ID,
    SEQ_PROV_2_ID,
    SECURITY_CODE,
    INSERT_DATETIME,
    INSERT_USER,
    INSERT_PROCESS,
    UPDATE_DATETIME,
    UPDATE_USER,
    UPDATE_PROCESS,
    USER_DEFINED_1,
    SALARY,
    PEC_END_DATE,
    REASON_CODE,
    PEC_WAIVED,
    BILL_EFFECTIVE_FROM_DATE,
    BILLED_THRU_DATE,
    PAID_THRU_DATE,
    SUBSC_DEPT,
    SUBSC_LOCATION,
    USE_EFT_FLG,
    BENEFIT_START_DATE,
    SEQ_ENROLLMENT_RULE,
    MCARE_RISK_ACCRETION_DATE,
    MCARE_RISK_DELETION_DATE,
    MCARE_RISK_REFUSED_DATE,
    COMMENTS,
    USER_DEFINED_2,
    USER_DEFINED_3,
    RATE_TYPE,
    PCPAA_OCCURRED,
    PRIVACY_ON,
    PCP_CHANGE_REASON,
    SITE_CODE,
    SEQ_SITE_ADDRESS_ID)
    values
    (hsd_seq_elig_hist.nextval,
    C.SEQ_MEMB_ID,
    C.SEQ_SUBS_ID,
    C.SUBSCRIBER_ID,
    C.PERSON_NUMBER,
    trunc(SYSDATE),
    C.TERM_DATE,
    C.TERM_REASON,
    C.RELATIONSHIP_CODE,
    C.SEQ_GROUP_ID,
    C.PLAN_CODE,
    C.LINE_OF_BUSINESS,
    C.RIDER_CODE_1,
    C.RIDER_CODE_2,
    C.RIDER_CODE_3,
    C.RIDER_CODE_4,
    C.RIDER_CODE_5,
    C.RIDER_CODE_6,
    C.RIDER_CODE_7,
    C.RIDER_CODE_8,
    C.MEDICARE_STATUS_FLG,
    C.OTHER_STATUS_FLAG,
    C.HIRE_DATE,
    C.ELIG_STATUS,
    C.PREM_OVERRIDE_STEP,
    C.PREM_OVERRIDE_AMT,
    C.PREM_OVERRIDE_CODE,
    C.SEQ_PROV_ID,
    C.IPA_ID,
    C.PANEL_ID,
    C.SEQ_PROV_2_ID,
    C.SECURITY_CODE,
    SYSDATE,
    USER,
    'TD33615',
    SYSDATE,
    USER,
    'TD33615',
    C.USER_DEFINED_1,
    C.SALARY,
    C.PEC_END_DATE,
    C.REASON_CODE,
    C.PEC_WAIVED,
    C.BILL_EFFECTIVE_FROM_DATE,
    C.BILLED_THRU_DATE,
    C.PAID_THRU_DATE,
    C.SUBSC_DEPT,
    C.SUBSC_LOCATION,
    C.USE_EFT_FLG,
    C.BENEFIT_START_DATE,
    C.SEQ_ENROLLMENT_RULE,
    C.MCARE_RISK_ACCRETION_DATE,
    C.MCARE_RISK_DELETION_DATE,
    C.MCARE_RISK_REFUSED_DATE,
    C.COMMENTS,
    C.USER_DEFINED_2,
    C.USER_DEFINED_3,
    C.RATE_TYPE,
    C.PCPAA_OCCURRED,
    C.PRIVACY_ON,
    C.PCP_CHANGE_REASON,
    C.SITE_CODE,
    C.SEQ_SITE_ADDRESS_ID);
    commit_cnt := commit_cnt + 1;
    if (commit_cnt = 1000) then
    dbms_output.put_line('Committed updates for 1000 records.');
    commit;
    commit_cnt := 0;
    end if;
    end loop;
    commit;
    dbms_output.put_line('Total number of MEMBER_ELIG_HISTROY records inserted : ' ||
    rec_cnt);
    exception
    when others then
    raise_application_error(-20001,
    'An error was encountered - ' || sqlcode ||
    ' -error- ' || sqlerrm);
    end;

    user10305724 wrote:
    I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. Please define what you mean by not working even if your computer screen is near the internet we can't see it.
    You should also look at the FAQ about how to ask a question
    SQL and PL/SQL FAQ
    Particularly *9) Formatting with {noformat}{noformat} Tags* and posting your version.
    know the reason why decode is not working, I heard some where Case statement do not work with 8i.
    Does this mean you are using 8i? Then scalar sub queries - selects within the select list, are not supported, along with CASE in PL/SQL.
    Select DECODE(1,
    * (Select 1
    from hsd_prov_contract R
    where R.seq_prov_id = PM.seq_prov_id
    and R.line_of_business = H.line_of_business
    and R.PCP_FLAG = 'Y'
    and R.participation_flag = 'P'
    and SYSDATE between R.EFFECTIVE_DATE AND
    NVL(R.TERM_DATE,
    TO_DATE('31-DEC-9999', 'DD-MON-YYYY')))*,
    'Y',
    'N') PAR_FLAG,
    >
    exception
    when others then
    raise_application_error(-20001,
    'An error was encountered - ' || sqlcode ||
    ' -error- ' || sqlerrm);
    http://tkyte.blogspot.com/2008/01/why-do-people-do-this.html                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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 External Table

    Hi,
    Can anyone tell me the difference between SQL* Loader and External table?
    What are the conditions under we can use SQL * Loader and External Table.
    Thanx

    External tables are accessible from SQL, which generally simplifies life if the data files are physically located on the database server since you don't have to coordinate a call to an external SQL*Loader script with other PL/SQL processing. Under the covers, external tables are normally just invoking SQL*Loader.
    SQL*Loader is more appropriate if the data files are on a different server or if it is easier to call an executable rather than calling PL/SQL (i.e. if you have a batch file that runs on a server other than the database server that wants to FTP a data file from a FTP server and then load the data into Oracle).
    Justin

  • Help in calling sql loader and an oracle procedure in a script

    Hi Guru's
    please help me in writing an unix script which will call sql loader and also an oracle procedure..
    i wrote an script which is as follows.
    !/bin/sh
    clear
    #export ORACLE_SID='HOBS2'
    sqlldr USERID=load/ps94mfo16 CONTROL=test_nica.ctl LOG=test_nica.log
    retcode=`echo $?`
    case "$retcode" in
    0) echo "SQL*Loader execution successful" ;;
    1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
    2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
    3) echo "SQL*Loader execution encountered a fatal error" ;;
    *) echo "unknown return code";;
    esac
    sqlplus USERID=load/ps94mfo16 << EOF
    EXEC DO_TEST_SHELL_SCRIPT
    it is loading the data in to an oracle table
    but the procedure is not executed..
    any valuable suggestion is highly appriciated..
    Cheers

    multiple duplicate threads:
    to call an oracle procedure and sql loader in an unix script
    Re: Can some one help he sql loader issue.

  • HELP: SQL*LOADER AND Ref Column

    Hallo,
    I have already posted and I really need help and don't come further with this
    I have the following problem. I have 2 tables which I created the following way:
    CREATE TYPE gemark_schluessel_t AS OBJECT(
    gemark_id NUMBER(8),
    gemark_schl NUMBER(4),
    gemark_name VARCHAR2(45)
    CREATE TABLE gemark_schluessel_tab OF gemark_schluessel_t(
    constraint pk_gemark PRIMARY KEY(gemark_id)
    CREATE TYPE flurstueck_t AS OBJECT(
    flst_id NUMBER(8),
    flst_nr_zaehler NUMBER(4),
    flst_nr_nenner NUMBER(4),
    zusatz VARCHAR2(2),
    flur_nr NUMBER(2),
    gemark_schluessel REF gemark_schluessel_t,
    flaeche SDO_GEOMETRY
    CREATE TABLE flurstuecke_tab OF flurstueck_t(
    constraint pk_flst PRIMARY KEY(flst_id),
    constraint uq_flst UNIQUE(flst_nr_zaehler,flst_nr_nenner,zusatz,flur_nr),
    flst_nr_zaehler NOT NULL,
    flur_nr NOT NULL,
    gemark_schluessel REFERENCES gemark_schluessel_tab
    Now I have data in the gemark_schluessel_tab which looks like this (a sample):
    1 101 Borna
    2 102 Draisdorf
    Now I wanna load data in my flurstuecke_tab with SQL*Loader and there I have problems with my ref column gemark_schluessel.
    One data record looks like this in my file (it is without geometry)
    1|97|7||1|1|
    If I wanna load my data record, it does not work. The reference (the system generated OID) should be taken from gemark_schluessel_tab.
    LOAD DATA
    INFILE *
    TRUNCATE
    CONTINUEIF NEXT(1:1) = '#'
    INTO TABLE FLURSTUECKE_TAB
    FIELDS TERMINATED BY '|'
    TRAILING NULLCOLS (
    flst_id,
    flst_nr_zaehler,
    flst_nr_nenner,
    zusatz,
    flur_nr,
    gemark_schluessel REF(CONSTANT 'GEMARK_SCHLUESSEL_TAB',GEMARK_ID),
    gemark_id FILLER
    BEGINDATA
    1|97|7||1|1|
    Is there a error I made?
    Thanks in advance
    Tig

    multiple duplicate threads:
    to call an oracle procedure and sql loader in an unix script
    Re: Can some one help he sql loader issue.

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

  • 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

  • Import and process larger data with SQL*Loader and Java resource

    Hello,
    I have a project to import data from a text file in a schedule. A lager data, with nearly 20,000 record/1 hours.
    After that, we have to analysis the data, and export the results into a another database.
    I research about SQL*Loader and Java resource to do these task. But I have no experiment about that.
    I'm afraid of the huge data, Oracle could be slowdown or the session in Java Resource application could be timeout.
    Please tell me some advice about the solution.
    Thank you very much.

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

  • SQL*LOADER에서 SEQUENCE 함수와 DECODE 함수 사용하는 방법

    제품 : ORACLE SERVER
    작성날짜 : 2003-08-22
    SQL*LOADER에서 SEQUENCE 함수와 DECODE 함수 사용하는 방법
    ========================================================
    PURPOSE
    Unique한 DATA을 load하고자 할때 쓰이는 SEQUENCE () 함수와 DECODE 함수의
    사용에 대해 알아보고자 한다.
    Explanation
    table의 data에 unique한 값을 넣기 위해 sequence을 만들어 사용한다. 이것은
    블루틴 #10863 을 참고하면 알수 있다. 이때 loader에서 database의 sequence기능이
    아닌 sequence() 함수를 사용하는 것을 테스트해 보고자 한다.
    또한 decode 함수를 사용하는 내용을 여기서 다루고자 한다.
    함수를 사용하는 경우는 conventional path load인 경우에만 가능하며 direct path load
    인 경우는 적용되지 않음을 주의하자.
    함수를 사용할때 참조하고자 하는 컬럼앞에 콜론(:)을 붙이면 된다.
    SEQUENCE 를 사용하면 각각의 레코드를 로드할때 특정 컬럼을 증가할수 있다.
    단 무시되거나 잘못되어 들어가지 않은 레코드에 대해서는 증가을 하지 않기
    때문에 주의하여야 한다.
    SEQUENCE 함수의 옵션에 대해 알아보자.
    SEQUENCE(n,increment) - 지정한 n 값부터 시작하여 increment 값만큼 증가한다.
    SEQUENCE(COUNT,increment) - table에 이미 존재하는 로우들을 count한 수에서
    시작하여 increment 값만큼 증가한다.
    SEQUENCE(MAX, increment - 해당 컬럼의 maximum 값에서 시작하여 increment
    값만큼 증가한다.
    Examples
    < Sequence 함수 사용 예 >
    1. sample table 생성
    create table t1
    (field1 number, field2 number, field3 varchar2(10));
    2. controlfile생성
    <sequence1.ctl>
    load data
    infile 'data1.dat'
    into table t1
    fields terminated by "," optionally enclosed by '"'
    (field1 SEQUENCE(MAX,1),
    field2,
    field3 )
    3. load할 datafile생성
    <data1.dat>
    1234, "ABC"
    3456, "CDF"
    4. 실행해 본다.
    $ sqlldr scott/tiger sequence1.ctl
    SQL> select * from t1;
    FIELD1 FIELD2 FIELD3
    1 1234 ABC
    2 3456 CDF
    < Decode 함수 사용 예 >
    test1 column이 'hello'이면 'goodbye'을 아니면 test1 column값을 로드하고자 한다.
    1. sample table 생성
    create table testldr
    (test1 varchar2(10), test2 varchar2(10));
    2. controlfile생성
    <decode1.ctl >
    Load data
    infile 'data2.dat'
    into table testldr
    fields terminated by ',' optionally enclosed by '"'
    (test1,
    test2 "decode(:test1, 'hello', 'goodbye', :test1)")
    3. load할 datafile생성
    <data2.dat>
    hello,""
    goodbye,""
    hey,""
    hello,""
    4. 실행해 본다.
    $ sqlldr scott/tiger decode1.ctl
    SQL> select * from testldr;
    SQL> select * from testldr;
    TEST1 TEST2
    hello goodbye
    goodbye goodbye
    hey hey
    hello goodbye
    Reference Ducument
    <Note 175126.1>
    <Note:1058895.6>
    <Note:1083518.6>

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

  • 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

Maybe you are looking for

  • MacBook Pro won't connect to the internet after standby

    Hallo all, I have the following strange problem with my macbook pro: - after going in stand by and returning in operating mode the mac won't connect to the internet, I have to follow the procedure in order to retry to connect but It does'not work. Go

  • Problem with  Handling  Exception  in Jsp

    hi I am unable to handling exception in Jsp. In my Simple Form i taken a simple text field named salary. Details.jsp <%@ page language="java" isErrorPage="true" errorPage="Det.jsp"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ tagli

  • Mac book pro connects

    I decided to buy a macbook pro 13 , I also have sony lcd projector Will the macbook pro connects with my vga projector or not? Answer plz

  • Nikon D300 Raw Images and Lightroom 1.4.1

    My updated 1.4.1 Lightroom and 4.4.1 Camera Raw are not reading the raw images from my new Nikon D300. I have read several strings of conversation from other folks who are having this problem, and from what I am reading, my 1.4.1 Lightroom should be

  • How to add record in infotype 82 and correspondingly to infotype 2001?

    Hi All, I need to create leaves. I can do it by using "HR_INFOTYPE_OPERATION" and create records in infotype 2001. But I also need to create corresponding records in infotype 0082. I have the leave types as stored in infotype 2001, like PCPI, PVCL et