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.

Similar Messages

  • BC4J Custom API: Batch Validation with Sequence-based primary key

    Hi people,
    I am trying to create a BC4J Custom API using the Batch Validation feature of iSetup Framework. However, my entity object has a sequence-based primary key, and this key is carried to the View Object. This way, i have three attributes marked as key attributes in the VO: InvoiceTypeId (the sequence), OrganizationId and InvoiceTypeCode (The alternate, developer key). the primary key is marked AZ_EXPORTABLE=FALSE, because it must be rebuilt in the target using the alternate key.
    I was able to successfully extract a single row to XML using this API (i am testing locally). When i try to import this XML file containing a single row, i get the following exception. Is this feature supported in Batch Validation mode?
    Regards
    Thiago Souza
    ** Exception starts **
    Started import...
    An exception occurred in API 'CLL Invoice Types'.
    oracle.apps.fnd.framework.OAException: An exception occurred in API 'CLL Invoice Types'.
         at oracle.apps.az.fwk.BEUtil.wrapperException(BEUtil.java:395)
         at oracle.apps.az.fwk.server.BEImport.populateTempTableForBatchValidation(BEImport.java:1927)
         at oracle.apps.az.fwk.server.BEImport.importXML(BEImport.java:371)
         at oracle.apps.az.fwk.server.BEApplicationModuleImpl.importFromXML(BEApplicationModuleImpl.java:404)
         at R12APITester.importFile(R12APITester.java:205)
         at R12APITester.importFile(R12APITester.java:180)
         at R12APITester.main(R12APITester.java:65)
    ## Detail 0 ##
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-06550: line 32, column 29:
    PL/SQL: ORA-00904: "KEY31": invalid identifier
    ORA-06550: linha 32, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 33, coluna 29:
    PL/SQL: ORA-00904: "KEY32": invalid identifier
    ORA-06550: linha 33, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 34, coluna 29:
    PL/SQL: ORA-00904: "KEY33": invalid identifier
    ORA-06550: linha 34, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 35, coluna 29:
    PL/SQL: ORA-00904: "KEY34": invalid identifier
    ORA-06550: linha 35, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 36, coluna 29:
    PL/SQL: ORA-00904: "KEY35": invalid identifier
    ORA-06550: linha 36, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 37, coluna 29:
    PL/SQL: ORA-00904: "KEY36": invalid identifier
    ORA-06550: linha 37, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 38, coluna 29:
    PL/SQL: ORA-00904: "KEY37": invalid identifier
    ORA-06550: linha 38, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 39, coluna 29:
    PL/SQL: ORA-00904: "KEY38": invalid identifier
    ORA-06550: linha 39, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 40, coluna 29:
    PL/SQL: ORA-00904: "KEY39": invalid identifier
    ORA-06550: linha 40, coluna 1:
    PL/SQL: SQL Statement ignored
    ORA-06550: linha 41, coluna 29:
    PL/SQL: ORA-00904: "KEY40": invalid identifier
    ORA-06550: linha 41, coluna 1:
    PL/SQL: SQL Statement ignored
         at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
         at oracle.apps.az.fwk.server.BEValidationXMLParser.executeSql(BEValidationXMLParser.java:288)
         at oracle.apps.az.fwk.server.BEValidationXMLParser.collectUKFKValues(BEValidationXMLParser.java:254)
         at oracle.apps.az.fwk.server.BEImport.populateTempTableForBatchValidation(BEImport.java:1897)
         at oracle.apps.az.fwk.server.BEImport.importXML(BEImport.java:371)
         at oracle.apps.az.fwk.server.BEApplicationModuleImpl.importFromXML(BEApplicationModuleImpl.java:404)
         at R12APITester.importFile(R12APITester.java:205)
         at R12APITester.importFile(R12APITester.java:180)
         at R12APITester.main(R12APITester.java:65)

    Hi Thiago,
    I would suggest to test your API first with row by row validation mode where you would be resolving the foreign and primary keys as specified in the framework. This would help you to understand the framework better and once it starts working for you and then you can try with batch validation mode.
    Thanks
    Mugunthan.

  • Insert record and return the primary key

    Okay, I need to insert a record into a MSSQL database and return the primary key of that record. Im using the following code which is obviously wrong as I'm getting either 'NULL' or 'com.microsoft.jdbc.base.BaseResultSet@1d520c4' returned depending on the ways I've tried. The primary key is an int value called clientID which is incremented by one each time a new record is added.
    // set the prepared statement
                String sql="INSERT INTO Client(username, country, clientIP, browser, os) VALUES(?,?,?,?,?)";
                PreparedStatement pstmt = conn.prepareStatement(sql);
                pstmt.setString(1, inUserName);
                pstmt.setString(2, inCountry);
                pstmt.setString(3, inClientIP);
                pstmt.setString(4, inBrowser);
                pstmt.setString(5, inOS);
                // Insert the row
                pstmt.executeUpdate();
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery("SELECT SCOPE_IDENTITY()");
                System.out.println("Result "+rs);The primary key value is needed so that it can be used as a foregin key in another table. Am I going about this the correct way? Any help, pointers or code fixing would be appreciated.....

    Yes. I tried this way but I only ever get the answer
    of 0 when i print our the result! Not really sure
    whats happening.That's because you don't print a ResultSet like that. In order to get the key out, you have to do this:
    int key = 0;
    while (rs.next())
        key = rs.getInt(1);What were you thinking with your code?
    You might want to do this in a transaction. If the INSERT fails, you'll want to roll back.
    The "select @@identity" is correct for M$ Access, SQL Server, and Sybase. I believe it's also correct for MySQL, but I'm not 100% certain of that.
    %

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

  • What is the best way to drop and recreate a Primary Key in the Replication Table?

    I have a requirement to drop and recreate a primary key in a table which is part of Transaction replication. What is the best way to fo it other than remove it from replication and add again?
    Thanks
    Swapna

    Hi Swapna,
    Unfortunately you cannot drop columns used in a primary key from articles in transactional replication.  This is covered in
    Make Schema Changes on Publication Databases:
    You cannot drop columns used in a primary key from articles in transactional publications, because they are used by replication.
    You will need to drop the article from the publication, drop and recreate the primary key, and add the article back into the publication.
    To avoid having to send a snapshot down to the subscriber(s), you could specify the option 'replication support only' for the subscription.  This would require the primary key be modified at the subscriber as well prior to adding the article back in
    and should be done during a maintenance window when no activity is occurring on the published tables.
    I suggest testing this out in your test environment first, prior to deploying to production.
    Brandon Williams (blog |
    linkedin)

  • 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 Control file for Tab-delimited fields

    i want to import a text-file with TAB-DELIMITED fields and a line-break + return at the end of each record.
    a want to do this by sql-loader and a control file.
    please, can someone give me the statement:
    e.g.
    load data
    infile 'exaple.txt' .......
    (...field1, field2,....)
    thank you very much

    Case Study 3: Loading a Delimited, Free-Format File
    http://otn.oracle.com/pls/db92/db92.to_URL?urlname=http:%2F%2Fdownload-west.oracle.com%2Fdocs%2Fcd%2FB10501_01%2Fserver.920%2Fa96652%2Fch10.htm%231006907
    Modify the example and use 'terminated by whitespace' instead
    For more information on TERMINATED Fields see
    http://otn.oracle.com/pls/db92/db92.to_URL?remark=drilldown&urlname=http:%2F%2Fdownload-west.oracle.com%2Fdocs%2Fcd%2FB10501_01%2Fserver.920%2Fa96652%2Fch06.htm%231013838

  • Propagate Properties option for Primary Keys?

    Hi,
    I have a physical model Oracle Database 11g created. I would like to change Using Index option from one value to another for most of primary keys in the model. Is there a way to do it? Additionally I would like to assign all primary key indexes to one tablespace.
    Now, I have to:
    1. Double click on one of the primary keys.
    2. Change Using Index option on General tab.
    3. Go to Using Index tab and select proper tablespace.
    All these steps have to be repeated for each primary key.
    Is there a way to do it once and propagate the change for all? There is similar option on indexes but I don't see it for primary keys.
    Arek

    Hi Arek,
    unfortunately there is no "Propagate Properties" functionality for primary keys.
    Philip

  • Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc

    Hi,
    Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc.
    Reason: We have a job that creates leads, tasks in 11i, but r12 is not working as expected, an SR is open with Oracle for a long time and no solution so far. I am thinking of using SQL*loader to populate the data, but these are html pages. Will SQL* Loader work?
    12.1.4 / 11g db
    Appreciate your inputs.
    Thanks,
    K

    Can SQL*Loader be used for Oracle html pages, for e.g Customer, Tasks etc. It should work.
    Reason: We have a job that creates leads, tasks in 11i, but r12 is not working as expected, What is the issue you have with R12?
    an SR is open with Oracle for a long time and no solution so far. I am thinking of using SQL*loader to populate the data, but these are html pages. Will SQL* Loader work?What was Oracle feedback? Did they say it is certified and can be used?
    Thanks,
    Hussein

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

  • 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

  • Calculate total and average for same key figure

    Hi Experts,
    I have a requirement where I need to calculate total and average for same key figure no of employees.
    eg:                
    If I enter 03,2009 as Input the reuslt should give from financiual year starting to current month.
         11.2008      12.2008     1.2009     2.2009     3.2009        average
             11          10       12       10        10         10.6
             10         10       11       12        10         10.6
    total         21         20       23       22        20          21.2
    we have only one characteristic in rows... companycode.
    Waiting for your Inputs.
    Regards
    Prasad Nannuri

    no it will work for u
    you have to use variable on 0calmonth or fiscal period depending on what Time characteristic u are using.
    lets say that variable is zcalmonth
    it is based on 0calmonth for e.g.
    now u restrict keyfigure with this variable zcalmonth with time char. = 0CALMONTH
    copy and paste the restricted keyfigure
    now set offset for variable in  variable selection screen dialog box = -1
    repeat this until u want
    make this variable mandatory
    now at query execution user will select any value for month/year
    and u will see all 5 months in result set
    now there can be maximum 12 months in a year, so u end up creating only 12 restricted keyfigures.
    use YEAR in restricted keyfigure too, and restrict it with YEAR VARIABLE processing by CUSTOMER EXIT = CURRENT YEAR
    in this case it will automatically removes any additional values...
    for e.e.g
    YEAR = 2008 only
    User entered 6/2008
    so lets say ur financial year starts in  april 2007 and ends in april 2008
    so u expect to see
    4/08
    5/08
    6/08
    but u created 12 restricted keyfigures , so it will show upto
    4,5,6 months only

Maybe you are looking for

  • Follow up on 4x6 Question

    Thanks again Beverly, your suggestions solved my print problem. However, the picture was slightly cropped at the top and it also had 2 very small borders on the left and right, being printed in landscape. In Page Set Up I wanted a vertical print not

  • Index.pdx  Dialog Warning Help

    Today, for the first time, an error (warning?) dialog box opens up when I open some of my PDF files. The files use to open without the dialog box, and now it appears when I open some of my files. After the PDF loads, a dialog box opens which states:

  • New tapeless camera support in Adobe Premiere Pro CS4

    Take advantage of the efficiency of tapeless cameras. Edit files from the latest tapeless formats natively, including AVCHD, P2, and XDCAM EX, without transcoding or rewrapping. With the integrated Media Browser, you can browse your hard disks from i

  • JSP variable in javascript

    Can I use a jsp variable in javascript? If so, how? It would be used in an "if" statement: function get This() { if (document.form.tfName.checked==true) || (<%jsp>) {   then do this...} }

  • Mail not moving messages or deleting from server until application quitted

    I have an Outlook.com email account. When I delete messages or move them in Apple Mail, the change is not reflected on the server until I quit the program completely. This isn't happening with other actions. Mail is immediately marked as read or flag