Trim Function in SQL Loader

Oracle version 10g
I have control file like below and would like to know is there a better way to declare trim function at the top level instead of specifying at field level. I want to remove leading or trailing spaces for the field.
LOAD DATA
INFILE *
TRUNCATE
INTO TABLE TMPTUPS_POD_DLY
ORD_NO POSITION(1:15) "TRIM(:ORD_NO)",
CUST_PO_NO POSITION(16:37) "TRIM(:CUST_PO_NO)",
SHP_NAME POSITION(38:72) "TRIM(:SHP_NAME)",
SHP_ADDR POSITION(73:102) "TRIM(:SHP_ADDR)",
SHP_CTY POSITION(103:132) "TRIM(:SHP_CTY)",
SHP_ST POSITION(133:134),
SHP_ZIP POSITION(135:144),
SHP_DT POSITION(145:154) DATE "YYYY-MM-DD",
TRCKNG_NO POSITION(155:184),
NOU POSITION(185:192) INTEGER EXTERNAL,
SHP_WGT POSITION(193:204) "TO_NUMBER(:SHP_WGT,'999999999999')/100",
POD_NAME POSITION(205:234) "TRIM(:POD_NAME)",
POD_DT POSITION(235:244) DATE "YYYY-MM-DD",
POD_TIME POSITION(245:252) DATE "HH:MI:SS",
AIR_BLL_PC POSITION(253:260) INTEGER EXTERNAL,
POD_STS_CD POSITION(261:262)
)

user13143312 wrote:
That's right. if I have 5 to 10 varchar2 columns I have to mention at the field level. Just like PRESERVE BLANKS or TRAILING NULLCOLS at the top level, I thought is there a way to trim all fields at the top level. I will continue to use at the field level. Thanks!http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#i1007768
If you specify them as varchar2's the trailing blanks will be trimmed.
Also ... to remove the leading blanks.
Optional Enclosure Delimiters
Leading whitespace is also removed from a field when optional enclosure delimiters are specified but not present.
Whenever optional enclosure delimiters are specified, SQL*Loader scans forward, looking for the first enclosure delimiter. If an enclosure delimiter is not found, SQL*Loader skips over whitespace, eliminating it from the field. The first nonwhitespace character signals the start of the field. This situation is shown in Field 2 in Figure 9-6. (In Field 1 the whitespace is included because SQL*Loader found enclosure delimiters for the field.)
"

Similar Messages

  • Using User function in SQL*Loader

    Hi, I have created the following control file. I am using DIRECT path insert. I am using a function to retrieve the column system_date. However, when I am running sql*loader, the fields system_date and load_date are loaded with null value.
    OPTIONS (ERRORS=999999999, DIRECT=TRUE, ROWS=100000, SKIP=1)
    LOAD DATA
    INFILE 'Z:\xx.csv'
    APPEND
    PRESERVE BLANKS
    INTO TABLE TB_RAW_DATA
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    REFERENCE_NUMBER,     
    SYSTEM_DATE "pkg_ken_utility.Fn_ken_get_param_value('SYSTEM_DATE','SYSTEM_DATE')",
    LOAD_DATE "SYSDATE"
    )

    No,
    You can not call PL/SQL functions in DIRECT PATH mode, also this is documented, so you should not need to ask.
    Sybrand Bakker
    Senior Oracle DBA

  • How to use nvl() function in SQL Loader

    I am trying to use nvl() funtion in my SQL Loader control file and I keep geting errors. Would someone please tell me where I can find the syntax reference to this?
    Thanks a lot!

    I just answered a similar question like this last Thursday.
    SQL*LOADER how to load blanks when data is null

  • Sql functions with SQL*loader

    For the testing purpose I created table
    SQL> desc test
    Name Null? Type
    C1 VARCHAR2(20)
    A file test.txt contains only one record:
    12/13/2007-09/15/2008
    control file contains:
    load data
    infile 'c:\grum\test\test.txt' "str '|'"
    insert into table test
    (c1 "substr(:c1,1,10)" )
    After performing Load
    SQL> select * from test;
    C1
    1
    I am unable to understand the value in the table should be:12/13/2007
    Can anybody help me please

    Try:
    (c1 position(1:10) )

  • Trim function in sql

    hi
    Iam using the oracle 9 database.In my data base i have column like
    column_name varchar2(41) but the data is 03265482036-03265482036(here both numbers are same).while processing the data how could i get only 03265482036. my data base contains 4 milion records

    hi
    Iam using the oracle 9 database.In my data base i
    have column like
    column_name varchar2(41) but the data is
    03265482036-03265482036(here both numbers are
    same).while processing the data how could i get only
    03265482036. my data base contains 4 milion recordsAssuming, that '-' is only possible delimiter...
    SELECT substr(col,1,instr(col,'-') - 1)

  • ORA-12899 error from function invoked from SQL*Loader

    I am getting the above error when I call a function from my SQL*Loader script, and I am not seeing what the problem is. As far as I can see, there should be no problem with the field lengths, unless the length of the automatic variable within my function is somehow being set at 30? Here are the details (in the SQL*Loader script, the field of interest is the last one):
    ====
    Error:
    ====
    Record 1: Rejected - Error on table TESTM8.LET_DRIVE_IN_FCLTY, column DIF_CSA_ID.
    ORA-12899: value too large for column "TESTM8"."LET_DRIVE_IN_FCLTY"."DIF_CSA_ID" (actual: 30, maximum: 16)
    =======
    Function:
    =======
    CREATE OR REPLACE FUNCTION find_MCO_id (di_oid_in DECIMAL)
    RETURN CHAR IS mco_id CHAR;
    BEGIN
    SELECT AOL_MCO_LOC_CD INTO mco_id
    FROM CONV_DI_FLCTY
    WHERE DIF_INST_ELMNT_OID = di_oid_in;
    RETURN TRIM(mco_id);
    END;
    ==============
    SQL*Loader Script:
    ==============
    LOAD DATA
    INFILE 'LET_DRIVE_IN_FCLTY.TXT'
    BADFILE 'LOGS\LET_DRIVE_IN_FCLTY_BADDATA.TXT'
    DISCARDFILE 'LOGS\LET_DRIVE_IN_FCLTY_DISCARDDATA.TXT'
    REPLACE
    INTO TABLE TESTM8.LET_DRIVE_IN_FCLTY
    FIELDS TERMINATED BY '~' OPTIONALLY ENCLOSED BY '"'
    DIF_DRIVE_IN_OID DECIMAL EXTERNAL,
    DIF_FCLTY_TYPE_OID DECIMAL EXTERNAL NULLIF DIF_FCLTY_TYPE_OID = 'NULL',
    DIF_INST_ELMNT_OID DECIMAL EXTERNAL,
    DIF_PRI_PERSON_OID DECIMAL EXTERNAL NULLIF DIF_PRI_PERSON_OID = 'NULL',
    DIF_SEC_PERSON_OID DECIMAL EXTERNAL NULLIF DIF_SEC_PERSON_OID = 'NULL',
    DIF_CREATE_TS TIMESTAMP "yyyy-mm-dd-hh24.mi.ss.ff6",
    DIF_LAST_UPDATE_TS TIMESTAMP "yyyy-mm-dd-hh24.mi.ss.ff6",
    DIF_ADP_ID CHAR NULLIF DIF_ADP_ID = 'NULL',
    DIF_CAT_CLAIMS_IND CHAR,
    DIF_CAT_DIF_IND CHAR,
    DIF_DAYLT_SAVE_IND CHAR,
    DIF_OPEN_PT_TM_IND CHAR,
    DIF_CSA_ID CONSTANT "find_MCO_id(:DIF_DRIVE_IN_OID)"
    ============
    Table Definitions:
    ============
    SQL> describe CONV_DI_FLCTY;
    Name Null? Type
    DIF_INST_ELMNT_OID NOT NULL NUMBER(18)
    AOL_MCO_LOC_CD NOT NULL VARCHAR2(3)
    SQL> describe LET_DRIVE_IN_FCLTY;
    Name Null? Type
    DIF_DRIVE_IN_OID NOT NULL NUMBER(18)
    DIF_INST_ELMNT_OID NOT NULL NUMBER(18)
    DIF_FCLTY_TYPE_OID NUMBER(18)
    DIF_ADP_ID VARCHAR2(10)
    DIF_CAT_DIF_IND NOT NULL VARCHAR2(1)
    DIF_CAT_CLAIMS_IND NOT NULL VARCHAR2(1)
    DIF_CSA_ID VARCHAR2(16)
    DIF_DAYLT_SAVE_IND NOT NULL VARCHAR2(1)
    DIF_ORG_ENTY_ID VARCHAR2(16)
    DIF_OPEN_PT_TM_IND NOT NULL VARCHAR2(1)
    DIF_CREATE_TS NOT NULL DATE
    DIF_LAST_UPDATE_TS NOT NULL DATE
    DIF_ITM_FCL_MKT_ID NUMBER(18)
    DIF_PRI_PERSON_OID NUMBER(18)
    DIF_SEC_PERSON_OID NUMBER(18)
    =========================
    Thanks for any help with this one!

    I changed one line of the function to:
    RETURN CHAR IS mco_id VARCHAR2(16);
    But I still get the same error:
    ORA-12899: value too large for column "TESTM8"."LET_DRIVE_IN_FCLTY"."DIF_CSA_ID" (actual: 30, maximum: 16)
    I just am not seeing what is being defined as 30 characters. Any ideas much appreciated!

  • SQL Loader ISSUE- when invoking function in a package - in Direct Path- SPK

    This is the loader file a.ctl
    load data
    append
    into table emp
    when eno='4'
    (eno number,
    ename varchar2(20))
    when (1)<>'4'
    into table detpt
    (deptno number,
    deplogid "Log.get_logid('logid')"
    Note: the deptlogid field is not null column.
    The par fie is as follows
    rows=1000
    errors=0
    direct=true
    control=a.ctl
    when i am running this file i am getting error when i am invoking the package Log.get_logid('logid')" in direct mode. It returns null value when it is used in control file.
    1) if i am running this function in sql prompt like
    select Log.get_logid('logid') from dual
    i am getting result as 121.
    2) what is the problem when the same function is used in Sql loader in direct mode.
    3) is there any restriction to use the function in sql loader?
    4) whether to use the function in sql loader is applicable for direct mode or conventional mode.
    5) when i am running in conventional mode it is working fine . what is the reason??
    I am running the loader from dos prompt like
    c:> sqlldr scott/tiger@dev parfile=abc.par
    Oracle 9i is the version for the loader.
    Please help me out to solve the issue

    This is the loader file a.ctl
    load data
    append
    into table emp
    when eno='4'
    (eno number,
    ename varchar2(20))
    when (1)<>'4'
    into table detpt
    (deptno number,
    deplogid "Log.get_logid('logid')"
    Note: the deptlogid field is not null column.
    The par fie is as follows
    rows=1000
    errors=0
    direct=true
    control=a.ctl
    when i am running this file i am getting error when i am invoking the package Log.get_logid('logid')" in direct mode. It returns null value when it is used in control file.
    1) if i am running this function in sql prompt like
    select Log.get_logid('logid') from dual
    i am getting result as 121.
    2) what is the problem when the same function is used in Sql loader in direct mode.
    3) is there any restriction to use the function in sql loader?
    4) whether to use the function in sql loader is applicable for direct mode or conventional mode.
    5) when i am running in conventional mode it is working fine . what is the reason??
    I am running the loader from dos prompt like
    c:> sqlldr scott/tiger@dev parfile=abc.par
    Oracle 9i is the version for the loader.
    Please help me out to solve the issue

  • SQL Loader: using your own function

    Hi,
    Is it possible to include your own function in sql*loader? Would this be a correct syntax?
    LOAD DATA
    APPEND
    INTO TABLE MY_TABLE
    IDE "my_seq.nextval"
    CLIENT_NBR POSITION (1:10)          CHAR     
    CLIENT_TYP POSITION (11:12)     "MY_PACKAGE.MY_FUNCTION(:CLIENT_TYP)"
    )So the value of the data ( position 11:12) needs te be processed first by the function. The result of the function needs to be stored in the CLIENT_TYP column.
    Thank you
    Message was edited by:
    Ratjeuh

    still yes/yes after the edit?Yes :)

  • Sql loader issue

    Hi I am trying to use decode function with sql loader.. and gating error
    SQL*Loader-350: Syntax error at line 8.
    Expecting "," or ")", found keyword nullif.
    code(:error_type,'Banned SBI',:error_type)" NULLIF error_type=BLANKS,
    My ctl file is below...
    LOAD DATA
    INFILE 'abc.dat'
    BADFILE 'abc.bad'
    INTO TABLE xyz_tmp
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (record_id INTEGER EXTERNAL(4) NULLIF record_id=BLANKS,
    error_type CHAR(100) "decode(:error_type,'Banned',:error_type)" NULLIF error_type=BLANKS,
    error_subtype CHAR(100) NULLIF error_subtype=BLANKS,
    number_of_errors INTEGER EXTERNAL(3) NULLIF number_of_errors=BLANKS,
    sbi_number INTEGER EXTERNAL(8) NULLIF sbi_number=BLANKS,
    team_name CHAR(60) NULLIF team_name=BLANKS
    Could any one help me to correct it please.

    Hi,
    Try changeing the line with decode to,
    error_type CHAR(100) "decode(trim(:error_type),NULL, NULL,'Banned',:error_type)" ,
    Cheers

  • Sql loader 1: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", ....

    Hello all,
    I am getting error while running below sql loader command...
    load data
    infile *
    into TABLE AP_SUPPLIER_SITES_INT
    REPLACE
    fields terminated by ","
    OPTIONALLY ENCLOSED BY '"'
    VENDOR_INTERFACE_ID expression "to_char('select VENDOR_INTERFACE_ID from AP_SUPPLIERS_INT where CUSTOMER_NUM=:CUSTOMER_NUM')",
    VENDOR_SITE_INTERFACE_ID "to_char(ap_supplier_sites_int_s.NEXTVAL)",
    LAST_UPDATE_DATE "SYSDATE",
    LAST_UPDATED_BY,
    VENDOR_SITE_CODE,
    CREATION_DATE "SYSDATE",
    CREATED_BY,
    PURCHASING_SITE_FLAG,
    PAY_SITE_FLAG,
    ADDRESS_LINE1,
    ADDRESS_LINE2,
    ADDRESS_LINE3,
    CITY,
    STATE,
    ZIP,
    COUNTRY,
    PHONE,
    FAX,
    PAYMENT_METHOD_LOOKUP_CODE,
    TERMS_ID,
    CREATE_DEBIT_MEMO_FLAG,
    HOLD_UNMATCHED_INVOICES_FLAG,
    EMAIL_ADDRESS,
    MATCH_OPTION,
    EXCLUDE_FREIGHT_FROM_DISCOUNT,
    INVOICE_CURRENCY_CODE,
    PAYMENT_CURRENCY_CODE,
    COUNTRY_OF_ORIGIN_CODE,
    FREIGHT_TERMS_LOOKUP_CODE,
    PAY_GROUP_LOOKUP_CODE,
    PAY_DATE_BASIS_LOOKUP_CODE,
    ALWAYS_TAKE_DISC_FLAG,
    ORG_ID)
    begindata
    1005,,SYSDATE,1132,Test MA Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120
    Log file:
    Table "AP"."AP_SUPPLIER_SITES_INT", loaded from every logical record.
    Insert option in effect for this table: REPLACE
    Column Name Position Len Term Encl Datatype
    VENDOR_INTERFACE_ID EXPRESSION
    SQL string for column : "to_char('select VENDOR_INTERFACE_ID from AP_SUPPLIERS_INT where CUSTOMER_NUM=:CUSTOMER_NUM')"
    VENDOR_SITE_INTERFACE_ID FIRST * , O(") CHARACTER
    SQL string for column : "to_char(ap_supplier_sites_int_s.NEXTVAL)"
    LAST_UPDATE_DATE NEXT * , O(") CHARACTER
    SQL string for column : "SYSDATE"
    LAST_UPDATED_BY NEXT * , O(") CHARACTER
    VENDOR_SITE_CODE NEXT * , O(") CHARACTER
    CREATION_DATE NEXT * , O(") CHARACTER
    SQL string for column : "SYSDATE"
    CREATED_BY NEXT * , O(") CHARACTER
    PURCHASING_SITE_FLAG NEXT * , O(") CHARACTER
    PAY_SITE_FLAG NEXT * , O(") CHARACTER
    ADDRESS_LINE1 NEXT * , O(") CHARACTER
    ADDRESS_LINE2 NEXT * , O(") CHARACTER
    ADDRESS_LINE3 NEXT * , O(") CHARACTER
    CITY NEXT * , O(") CHARACTER
    STATE NEXT * , O(") CHARACTER
    ZIP NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    PHONE NEXT * , O(") CHARACTER
    FAX NEXT * , O(") CHARACTER
    PAYMENT_METHOD_LOOKUP_CODE NEXT * , O(") CHARACTER
    TERMS_ID NEXT * , O(") CHARACTER
    CREATE_DEBIT_MEMO_FLAG NEXT * , O(") CHARACTER
    HOLD_UNMATCHED_INVOICES_FLAG NEXT * , O(") CHARACTER
    EMAIL_ADDRESS NEXT * , O(") CHARACTER
    MATCH_OPTION NEXT * , O(") CHARACTER
    EXCLUDE_FREIGHT_FROM_DISCOUNT NEXT * , O(") CHARACTER
    INVOICE_CURRENCY_CODE NEXT * , O(") CHARACTER
    PAYMENT_CURRENCY_CODE NEXT * , O(") CHARACTER
    COUNTRY_OF_ORIGIN_CODE NEXT * , O(") CHARACTER
    FREIGHT_TERMS_LOOKUP_CODE NEXT * , O(") CHARACTER
    PAY_GROUP_LOOKUP_CODE NEXT * , O(") CHARACTER
    PAY_DATE_BASIS_LOOKUP_CODE NEXT * , O(") CHARACTER
    ALWAYS_TAKE_DISC_FLAG NEXT * , O(") CHARACTER
    ORG_ID NEXT * , O(") CHARACTER
    value used for ROWS parameter changed from 64 to 31
    Record 1: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
    ORA-01722: invalid number
    Please guide me what could be an issue...
    Is there any other way to pass function in sql loader..
    Thanks and Regards
    Muthukumar

    I created function like below...... retrun value as number
    create or replace function VDR_INF_F(V_NUM number)
    return number is
    VDR_INF_id AP_SUPPLIERS_INT.VENDOR_INTERFACE_ID%type;
    begin
    select VENDOR_INTERFACE_ID
    into VDR_INF_id
    from AP_SUPPLIERS_INT
    where CUSTOMER_NUM = V_NUM;
    return VDR_INF_id;
    end;
    And attached that into loader program...
    load data
    infile *
    into TABLE AP_SUPPLIER_SITES_INT
    REPLACE
    fields terminated by ","
    OPTIONALLY ENCLOSED BY '"'
    VENDOR_SITE_INTERFACE_ID "to_char(ap_supplier_sites_int_s.NEXTVAL)",
    LAST_UPDATE_DATE "SYSDATE",
    LAST_UPDATED_BY,
    VENDOR_SITE_CODE,
    CREATION_DATE "SYSDATE",
    CREATED_BY,
    PURCHASING_SITE_FLAG,
    PAY_SITE_FLAG,
    ADDRESS_LINE1,
    ADDRESS_LINE2,
    ADDRESS_LINE3,
    CITY,
    STATE,
    ZIP,
    COUNTRY,
    PHONE,
    FAX,
    PAYMENT_METHOD_LOOKUP_CODE,
    TERMS_ID,
    CREATE_DEBIT_MEMO_FLAG,
    HOLD_UNMATCHED_INVOICES_FLAG,
    EMAIL_ADDRESS,
    MATCH_OPTION,
    EXCLUDE_FREIGHT_FROM_DISCOUNT,
    INVOICE_CURRENCY_CODE,
    PAYMENT_CURRENCY_CODE,
    COUNTRY_OF_ORIGIN_CODE,
    FREIGHT_TERMS_LOOKUP_CODE,
    PAY_GROUP_LOOKUP_CODE,
    PAY_DATE_BASIS_LOOKUP_CODE,
    ALWAYS_TAKE_DISC_FLAG,
    ORG_ID,
    VENDOR_INTERFACE_ID expression "VDR_INF_F(':CUSTOMER_NUM')"
    begindata
    1005,,SYSDATE,1132,Test MA Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1005
    1005,,SYSDATE,1132,Test MA Site_2,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1005
    1005,,SYSDATE,1132,Test MA Site_3,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1005
    1006,,SYSDATE,1132,Test1 M Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1006
    1007,,SYSDATE,1132,Test1 B Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1007
    Even now sql loader giving same error..
    like below.....
    able "AP"."AP_SUPPLIER_SITES_INT", loaded from every logical record.
    Insert option in effect for this table: REPLACE
    Column Name Position Len Term Encl Datatype
    VENDOR_SITE_INTERFACE_ID FIRST * , O(") CHARACTER
    SQL string for column : "to_char(ap_supplier_sites_int_s.NEXTVAL)"
    LAST_UPDATE_DATE NEXT * , O(") CHARACTER
    SQL string for column : "SYSDATE"
    LAST_UPDATED_BY NEXT * , O(") CHARACTER
    VENDOR_SITE_CODE NEXT * , O(") CHARACTER
    CREATION_DATE NEXT * , O(") CHARACTER
    SQL string for column : "SYSDATE"
    CREATED_BY NEXT * , O(") CHARACTER
    PURCHASING_SITE_FLAG NEXT * , O(") CHARACTER
    PAY_SITE_FLAG NEXT * , O(") CHARACTER
    ADDRESS_LINE1 NEXT * , O(") CHARACTER
    ADDRESS_LINE2 NEXT * , O(") CHARACTER
    ADDRESS_LINE3 NEXT * , O(") CHARACTER
    CITY NEXT * , O(") CHARACTER
    STATE NEXT * , O(") CHARACTER
    ZIP NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    PHONE NEXT * , O(") CHARACTER
    FAX NEXT * , O(") CHARACTER
    PAYMENT_METHOD_LOOKUP_CODE NEXT * , O(") CHARACTER
    TERMS_ID NEXT * , O(") CHARACTER
    CREATE_DEBIT_MEMO_FLAG NEXT * , O(") CHARACTER
    HOLD_UNMATCHED_INVOICES_FLAG NEXT * , O(") CHARACTER
    EMAIL_ADDRESS NEXT * , O(") CHARACTER
    MATCH_OPTION NEXT * , O(") CHARACTER
    EXCLUDE_FREIGHT_FROM_DISCOUNT NEXT * , O(") CHARACTER
    INVOICE_CURRENCY_CODE NEXT * , O(") CHARACTER
    PAYMENT_CURRENCY_CODE NEXT * , O(") CHARACTER
    COUNTRY_OF_ORIGIN_CODE NEXT * , O(") CHARACTER
    FREIGHT_TERMS_LOOKUP_CODE NEXT * , O(") CHARACTER
    PAY_GROUP_LOOKUP_CODE NEXT * , O(") CHARACTER
    PAY_DATE_BASIS_LOOKUP_CODE NEXT * , O(") CHARACTER
    ALWAYS_TAKE_DISC_FLAG NEXT * , O(") CHARACTER
    ORG_ID NEXT * , O(") CHARACTER
    VENDOR_INTERFACE_ID EXPRESSION
    SQL string for column : "VDR_INF_F(':CUSTOMER_NUM')"
    value used for ROWS parameter changed from 64 to 31
    Record 1: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
    ORA-01722: invalid number
    Record 4: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
    ORA-01722: invalid number
    Record 5: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
    ORA-01722: invalid number
    Please guide me, how to clear this issue?
    Thanks and Regards,
    Muthu

  • Possibility of capturing data file name in SQL * Loader

    Hi,
    I have a requirement to capture the data file name in the staging table, is there a way that i can capture it in SQL * Loader or any other way of doing it.
    Need experts suggestion please.
    Thanks,
    Genoo

    Hi Genoo.
    how do we capture the file name and stores in the temporary table
    You may use the above command mentioned in my previous post (if Linux) to populate the Test.csv file with the available file name in the directory, i.e:
    ls /some/path/*.dat | xargs -n1 basename  > /home/oracle/Test.csv
    1. Ensure to first load the Test.csv file as for eg:
    1,aaa
    2,bbb
    3,ccc
    2. Create a control file to load these records into temporary tables,for eg:
    load data
    infile '/home/oracle/Test.csv'
    into table file_name_upload
    fields terminated by ","
    ( id, file_name )
    3. Create the respective table in the database:
    create table file_name_upload
      id number,
      file_name varchar2(20)
    4. Load the data into temporary table
    sqlldr test/test control=/home/oracle/sqlldr_test.ctl
    Please refer notes:
    SQL*Loader - How To Load A Date Column With Fractions Of Second (Doc ID 1276259.1)
    Script To Generate SQL*Loader Control File (Doc ID 1019523.6)
    SQL*Loader performance tips (Doc ID 28631.1)
    How To use the Sequence Function of SQL*Loader (Doc ID 1058895.6)
    How to Get Data from Existing Table to Flat File Usable by SQL*Loader (Doc ID 123852.1)
    Also see link:
    10 Oracle SQLLDR Command Examples (Oracle SQL*Loader Tutorial)
    Thanks &
    Best regards,

  • SQL Loader Urgent

    We want to load two tables from one file simultaneously from one comma separated data file. These tables has Master-Detail relation. Each row in the text file contain all the fields for Master Table and in some field fields of Detail table and data in text file is stored as Concatenated string ~ separated.
    Text file
    1, Sinatra, Jalora, Concatenated~String~Separated,11.00
    Mater Table
    1, Sinatra, Jalora, 11.0
    Detail table
    1, Concatenated
    1, String
    1, Separated
    We want to call a function in SQL Loader to insert into Detail Table. If Yes Then How??
    null

    Hi Sanya
    I don't now technique in SQLLodar how get detail table, but you can try another technique trouhg trigger.
    Look this :
    1. This is base tables
    create table masterT (id number primary key,Fname varchar2(40),Lname varchar2(40),value number(10,2));
    create table detailT1 (id number primary key,masterT_id number references masterT(id),text varchar2(80));
    2. This is fictive table a his trigger
    create table xxx ( id number primary key, Fname varchar2(40), Lname varchar2(40), text varchar2(2000), value number(10,2));
    create or replace trigger tg_xxx_i
    before insert on xxx for each row
    declare
    lm number := 1;
    ln number := 1;
    lx varchar2(2000);
    lmastert_id number;
    begin
    insert into masterT values (:new.id,:new.fname,:new.lname,:new.value);
    lx := :new.text;
    lm := instr(lx,'~',ln);
    while lm > 0 loop
    insert into detailT1 values (seqdetailT1.Nextval(),mastert_id,substr(lx,ln,lm-ln));
    ln := lm + 1;
    lm := instr(lx,'~',ln);
    end loop;
    insert into detailT1 values (seqdetailT1.Nextval(),:new.mastert_id,substr(lx,ln,2000));
    end;
    ed
    null

  • Is license required for Sql Loader?

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

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

  • 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 loader using position and functions

    Hi all, i need help loading some data in my table using sql loader. consider the following
    CREATE TABLE er
    a1 NUMBER,
    a2 number,
    a3 VARCHAR2(100),
    a4 VARCHAR2(100),
    a5 VARCHAR2(100),
    a6  VARCHAR2(100),
    a7  VARCHAR2(100),
    a8  VARCHAR2(100)
    OPTIONS (BINDSIZE=20548000, READSIZE=20548000, STREAMSIZE=20548000, DATE_CACHE=25000,  SKIP=0)
    LOAD DATA
    INTO TABLE er
    APPEND    
    TRAILING NULLCOLS
      a1            POSITION(0001:0021)               ,
      a2            POSITION(0022:0042)       "DECODE(SUBSTR(:a2,1,3),'***',NULL,:a2)"      ,
      a3            POSITION(0043:0053)       ,
      a4            POSITION(0054:0064)          ,
      a5            POSITION(0065:0075)           ,
      a6            POSITION(0076:0086)       ,
      a7            POSITION(0087:0093)      "DECODE(SUBSTR(:a7,1,3),'***',NULL,:a7)"  
    BEGIN
                     0.00 ******************** X          X          X          *X          ****
    END;if you look at the data, some fields have a lot of * and some has af few such as ****. i want to load this data into a table and when a field contain all * as a value, i want to set it to null. if a field contain a * and alphanumeric then that value should be load as it is.
    in the example above, ******************** should be set to null and **** should also be set to null. notice that there is a field with X. since this field contain alpha numeric, it should be loaded into the table as is.  the only time field should be set to null is when the value contain all .
    somebody in this forum suggest using decode but it looks like it is not working and i get error when it reads second field and try to insert into a2 number column.
    is there any way to use regular expression to find out if a field contain all *. also i want to trim each field since they might contain leading spaces.
    can some one help with this using the sqlloader ctl and data above?

    You can include regular expression in you SQL*Loader control file.
    An example can be found here:
    http://www.morganslibrary.org/reference/sqlloader.html
    Demos 7 and 8 using the UPPER and DECODE functions to illustrate how to do it.

Maybe you are looking for