Why is the child table inserting first in a composite association?

Guys and Gals,
Studio Edition Version 11.1.1.3.0.
This one has gotten me all day. I have a child table which is inserting before its master table, even though the relationship is defined as a composite relationship.
Process:
1) User adds a part with a purchase price into the Part table.
2) Via Part-PartHistories View Link, part is inserted into PartHistories.
3) Via BPL-BPLRows View Link, part is inserted into BPLRows along with its purchase price. The part number is part of a composite primary key (BPL,PartNumber) and is a foreign key to the Part table.
4) Via BPL-PL View Link, and then Via PL-PLRows View Link, part is inserted into PLRows along with its purchase price. The part number is part of a composite primary key (PL,PartNumber) and is a foreign key to the Part table.
It is #4 which gives me an integrity constraint (PCS.PRICE_BUCKETS_PARTS_FK1) violated - parent key not found error. JDev is trying to insert in the order 4,1,2,3 when it should be 1,2,3,4. The kicker is that there is a composite association between #1 and #4 which should guarantee that 1 is inserted first. If I remove #4's process, steps 1-3 run fine. If I remove the composite association, JDev inserts correctly steps 1,2,3,4.
Why is JDev trying to insert #4 first? I do a CreateInsert on the Parts table first so the creation order is correct. Furthermore, there is a composite association defined between Parts - PLRows.
Something is indeed fishy in Denmark.

LovettWB,
You talk about VOs, but composite relationships need to be defined at the EO level. If you have indeed defined the proper composite associations, this sounds like a perfect test case to submit to Oracle Support to evaluate.
If you do have the proper associations set up and things don't work, you could try [url http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcadveo.htm#CEGECADE]this technique as a workaround.
John

Similar Messages

  • Parent - Child Table Insert Trigger

    Hello,
    I need some help with an Insert Trigger. I want to Insert some field data from 'Table A' to 'Table B' based on a PK and FK. Does anyone have any sample code?
    <code>
    Table A
    SEQ_NO --PK
    FIELD A
    FIELD B
    FIELD C
    Table B
    FK_SEQ_NO
    FIELD B
    FIELD C
    <code>
    When data is saved in 'Table A' I need to populate the 'FK_SEQ_NO' based on the saved value from 'Table A' 'SEQ_NO' along with the FIELD B and FIELD C values saved to Table B.
    Any help is really appreciated, thanks.

    Hi,
    How about this:
    create or replace TRIGGER rmdb_work_packages_biudr_trg
    BEFORE INSERT OR UPDATE OR DELETE ON rmdb_work_packages
    FOR EACH ROW
    DECLARE
      l_module_name          CONSTANT VARCHAR2(100) :=  'tpsdev.rmdb_work_packages_biudr_trg';
    BEGIN
      IF INSERTING THEN
        -- generate a PK sequence if not already set
        IF :new.work_package_id IS NULL THEN
          SELECT rmdb_work_packages_seq.NEXTVAL
          INTO :new.work_package_id
          FROM dual;
        END IF;
        -- populate audit columns
        :NEW.created_by := NVL(v('APP_USER'),user);
        :NEW.creation_date := SYSDATE;
      END IF;
      IF INSERTING OR UPDATING THEN
        IF :new.business_sign_off_flag IS NULL THEN
          -- set the business_sign_off_flag = 'N' if it is null
          :new.business_sign_off_flag := 'N';
        END IF;
        IF :new.at_risk_flag IS NULL THEN
          -- set the at_risk_flag = 'N' if it is null
          :new.at_risk_flag := 'N';
        END IF;
        IF :new.resource_required_flag IS NULL THEN
          -- set the resource_required_flag = 'Y' if it is null
          :new.resource_required_flag := 'N';
        END IF;
        IF :new.contains_patches_flag IS NULL THEN
          -- set the contains_patches_flag = 'Y' if it is null
          :new.contains_patches_flag := 'N';
        END IF;
        -- populate audit columns
        :NEW.last_updated_by := NVL(v('APP_USER'),user);
        :NEW.last_update_date := SYSDATE;
      END IF;
      IF INSERTING THEN
        INSERT INTO RMDB_WP_HISTORY
        WORK_PACKAGE_ID,
        PROJECT_ID,
        SERVICE_ID,
        RELEASE_ID,
        NAME,
        DESCRIPTION,
        COMMENTS,
        WP_TYPE_CODE,
        RESOURCE_REQUIRED_FLAG,
        WP_STATUS_CODE,
        CHANGE_PROBABILITY_CODE,
        CHANGE_IMPACT_CODE,
        APP_USER_ID_OWNER,
        APP_USER_ID_DEPUTY,
        WP_PRIORITY_CODE,
        PRIORITY_JUSTIFICATION,
        REQUIRED_LIVE_DATE,
        BUSINESS_SIGN_OFF_FLAG,
        AT_RISK_FLAG,
        CONTAINS_PATCHES_FLAG,
        PM_REFERENCE,
        MARVAL_NUMBER,
        RCD_NOTES,
        CREATED_BY,
        CREATION_DATE,
        LAST_UPDATED_BY,
        LAST_UPDATE_DATE
        VALUES
       :NEW.WORK_PACKAGE_ID,
       :NEW.PROJECT_ID,
       :NEW.SERVICE_ID,
       :NEW.RELEASE_ID,
       :NEW.NAME,
       :NEW.DESCRIPTION,
       :NEW.COMMENTS,
       :NEW.WP_TYPE_CODE,
       :NEW.RESOURCE_REQUIRED_FLAG,
       :NEW.WP_STATUS_CODE,
       :NEW.CHANGE_PROBABILITY_CODE,
       :NEW.CHANGE_IMPACT_CODE,
       :NEW.APP_USER_ID_OWNER,
       :NEW.APP_USER_ID_DEPUTY,
       :NEW.WP_PRIORITY_CODE,
       :NEW.PRIORITY_JUSTIFICATION,
       :NEW.REQUIRED_LIVE_DATE,
       :NEW.BUSINESS_SIGN_OFF_FLAG,
       :NEW.AT_RISK_FLAG,
       :NEW.CONTAINS_PATCHES_FLAG,
       :NEW.PM_REFERENCE,
       :NEW.MARVAL_NUMBER,
       :NEW.RCD_NOTES,
       :NEW.CREATED_BY,
       :NEW.CREATION_DATE,
       :NEW.LAST_UPDATED_BY,
       :NEW.LAST_UPDATE_DATE  
      END IF;
      IF UPDATING THEN
        INSERT INTO RMDB_WP_HISTORY
        WORK_PACKAGE_ID,
        PROJECT_ID,
        SERVICE_ID,
        RELEASE_ID,
        NAME,
        DESCRIPTION,
        COMMENTS,
        WP_TYPE_CODE,
        RESOURCE_REQUIRED_FLAG,
        WP_STATUS_CODE,
        CHANGE_PROBABILITY_CODE,
        CHANGE_IMPACT_CODE,
        APP_USER_ID_OWNER,
        APP_USER_ID_DEPUTY,
        WP_PRIORITY_CODE,
        PRIORITY_JUSTIFICATION,
        REQUIRED_LIVE_DATE,
        BUSINESS_SIGN_OFF_FLAG,
        AT_RISK_FLAG,
        CONTAINS_PATCHES_FLAG,
        PM_REFERENCE,
        MARVAL_NUMBER,
        RCD_NOTES,
        CREATED_BY,
        CREATION_DATE,
        LAST_UPDATED_BY,
        LAST_UPDATE_DATE
        VALUES
        :NEW.WORK_PACKAGE_ID,
        :NEW.PROJECT_ID,
        :NEW.SERVICE_ID,
        :NEW.RELEASE_ID,
        :NEW.NAME,
        :NEW.DESCRIPTION,
        :NEW.COMMENTS,
        :NEW.WP_TYPE_CODE,
        :NEW.RESOURCE_REQUIRED_FLAG,
        :NEW.WP_STATUS_CODE,
        :NEW.CHANGE_PROBABILITY_CODE,
        :NEW.CHANGE_IMPACT_CODE,
        :NEW.APP_USER_ID_OWNER,
        :NEW.APP_USER_ID_DEPUTY,
        :NEW.WP_PRIORITY_CODE,
        :NEW.PRIORITY_JUSTIFICATION,
        :NEW.REQUIRED_LIVE_DATE,
        :NEW.BUSINESS_SIGN_OFF_FLAG,
        :NEW.AT_RISK_FLAG,
        :NEW.CONTAINS_PATCHES_FLAG,
        :NEW.PM_REFERENCE,
        :NEW.MARVAL_NUMBER,
        :NEW.RCD_NOTES,
        :NEW.CREATED_BY,
        :NEW.CREATION_DATE,
        :NEW.LAST_UPDATED_BY,
        :NEW.LAST_UPDATE_DATE
      END IF;
      IF DELETING THEN
        DELETE FROM RMDB_WP_HISTORY
        WHERE WORK_PACKAGE_ID = :NEW.WORK_PACKAGE_ID;
      END IF;
    END rmdb_work_packages_biudr_trg; There is also a trigger on the child table:
    create or replace TRIGGER RMDB_WP_HISTORY_BIUDR_TRG
    BEFORE INSERT OR UPDATE OR DELETE ON RMDB_WP_HISTORY
    FOR EACH ROW
    BEGIN
      IF INSERTING THEN
        -- generate a PK sequence if not already set
        IF :new.WP_HISTORY_ID    IS NULL THEN
           SELECT RMDB_WP_HISTORY_SEQ.NEXTVAL
           INTO :new.WP_HISTORY_ID
           FROM dual;
        END IF;
      END IF;
    END RMDB_WP_HISTORY_BIUDR_TRG; Does that help?
    Regards,
    Martin

  • Unable to find the deleted record in the child table

    Hi,
    I have two tables and a trigger:
    CREATE TABLE parent (a INTEGER, b CHAR(10));
    CREATE TABLE child (c CHAR(10), d INTEGER);
    CREATE TRIGGER parent_trigger
    AFTER INSERT OR DELETE OR UPDATE ON parent
    REFERENCING NEW AS newRow
    FOR EACH ROW
    BEGIN
    INSERT INTO child VALUES(:newRow.b, :newRow.a);
    END parent_trigger;
    Now my point is , after insertion or updation of the records in the parent table, the records are created successfully in child table...
    BUT.. on deleting a record the record is deleted successfully from parent table..but the record is not displayed in the child table.
    SQL> delete from parent where A=2;
    1 row deleted.
    SQL> select * from parent;
    no rows selected
    SQL> set feedback on
    SQL> select * from child;
    C D
    a 1
    a 2
    3 rows selected.
    Please help.

    What's the value of :NEW variables after deletion? NULL! What gets inserted into your child table? You guess it... :)

  • In the parent table has a ROWID of an index of the child table FK!

    From the structure of the heap table is a problem.
    PK has a parent table.
    Child table has a FK.
    If you have FK to the parent table has a ROWID, I think in terms of speed to get the best performance.
    what do you think?
    Edited by: user5647868 on 2011. 9. 29 오후 10:46

    Of course, if the parent table FK ribildeuhal should rebuild the index.
    In reality, however, if the parent table, there were no ribildeuhaneun.
    If you need to rebuild a lot if you have a DOWNTIME.
    In some cases, even given the option to ALTER TABLE will be.
    Is the child table FK halgeot rebuild?
    FK using ROWID in the index of the parent decide to disable?
    And so on.

  • How to identify all the child tables referencing a master table

    Hi,
    How to identify all the child tables referencing a master table.
    Could you please help me...
    Thanks in advance...

    Hi!
    You may use this query:
    SELECT master.table_name, child.table_name
    FROM   user_constraints master, user_constraints child
    WHERE  master.table_name IN ('REGIONS')
      AND  master.constraint_name = child.r_constraint_name
    /yours sincerely
    Florian W.

  • Why do the photos in my first InDesign project  look really bad?

    Why do the photos in my first InDesign project look really bad? Noticed as I "placed" them, some PDFs or JPEGs (not photos, but PDFs converted to JPEG) looked pretty distorted. Went ahead with the 60+ page project, converted to PDF, sent to client. He converted to a flipbook to proof and really didn't like the photos. Here's the irony. Upgraded to InDesign for this client. Was using Publisher as a standby until I could afford InDesign. Signed up with the Creative Cloud because job was overwhelming Publisher.
    I started the job without a whole lot of knowledge (or patience for the tutorials) and figured I just wing it (and get InDesign for Dummies). Am thinking somethingw as screwed up in the initial setting up of the job. So how do I figure out if this is the issue and can I fix it without redoing all 60+ pages. If anybody has an answer, please let me know.

    helpmemama wrote:
    Why do the photos in my first InDesign project look really bad? Noticed as I "placed" them, some PDFs or JPEGs (not photos, but PDFs converted to JPEG) looked pretty distorted. Went ahead with the 60+ page project, converted to PDF, sent to client. He converted to a flipbook to proof and really didn't like the photos. Here's the irony. Upgraded to InDesign for this client. Was using Publisher as a standby until I could afford InDesign. Signed up with the Creative Cloud because job was overwhelming Publisher.
    I started the job without a whole lot of knowledge (or patience for the tutorials) and figured I just wing it (and get InDesign for Dummies). Am thinking somethingw as screwed up in the initial setting up of the job. So how do I figure out if this is the issue and can I fix it without redoing all 60+ pages. If anybody has an answer, please let me know.
    Ok, first image on your indesign page or any other program for that matter are still images, they are no longer pdf's, jpg's, psd's, etc. Once they load into a program, the file format is no longer relevant until you save again. Onl;y on your drive is the format relavent.
    Second, if you can help it, never use jpg's until you are completely done and will be sharing a jpg. Jpg's are a lossy format are are not the best for preserving quality on your drive. Each time you open a jpg, and save a jpg more data is lost, as that is how that format compresses the data, by throwing it way for ever.
    Third, the problem may not even be with you, it could happen when that person created a flipbook. That is an unknown varible, one which could make you look bad when it had nothing to do with you.
    Fourth, Pay attention to the pixel dimentions of your images, the higher those values are the better the quality. Scaling can and probably will reduce that quality. If you can, it is better to hide parts of the image by cropping with a frame than it is to scale the image. you can scale, but pay attention to it.
    I will stop there for now, as some of what I wrote is based on assumtions. That normally does not work out too well.

  • How to delete the duplicate rows present in the parent table & insert the latest duplicate record into the parent table linked with the child table.

    I have a master table and i need to import the rows into the parent and child table.
    Master table name is Flatfile_Inventory
    Parent Table name is INVENTORY
    Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
    Error details will be goes to LOG_INVENTORY_ERROR
    I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
    Again when i run the query using stored procedure,
    its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
    I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
    must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
    Please help me to write the query i have attached the Full stored procedure Script..
    Arunraj Kumar

    Hi Santhosh,
    This is my Script.
    -- =============================================
    -- Stored Procedure for FLATFILE_INVENTORY
    -- =============================================
    -- Drop stored procedure if it already exists
       DROP PROCEDURE SP_Flatfile_Inventory
    GO
    CREATE PROCEDURE SP_Flatfile_Inventory
    AS
    --USE IconicMarketing
    GO
    DECLARE
    @FileType  varchar(50)  ,
    @ACDealerID  varchar(50)  ,
    @ClientDealerID  varchar(50)  ,
    @DMSType  varchar(50)  ,
    @StockNumber  varchar(50)  ,
    @InventoryDate  datetime  ,
    @StockType  varchar(100)  ,
    @DMSStatus  varchar(50)  ,
    @InvoicePrice  numeric(18, 2)  ,
    @CostPack  varchar(50)  ,
    @SalesCost  numeric(18, 2)  ,
    @HoldbackAmount  numeric(18, 2)  ,
    @ListPrice  numeric(18, 2)  ,
    @MSRP  varchar(max)  ,
    @LotLocation  varchar(50)  ,
    @TagLine  varchar(max)  ,
    @Certification  varchar(max)  ,
    @CertificationNumber  varchar(max)  ,
    @VehicleVIN  varchar(50)  ,
    @VehicleYear  bigint  ,
    @VehicleMake  varchar(50)  ,
    @VehicleModel  varchar(50)  ,
    @VehicleModelCode  varchar(50)  ,
    @VehicleTrim  varchar(50)  ,
    @VehicleSubTrimLevel  varchar(max)  ,
    @Classification  varchar(max)  ,
    @TypeCode  varchar(100)  ,
    @VehicleMileage  bigint  ,
    @EngineCylinderCount  bigint  ,
    @TransmissionType  varchar(50)  ,
    @VehicleExteriorColor  varchar(50)  ,
    @VehicleInteriorColor  varchar(50)  ,
    @CreatedDate  datetime  ,
    @LastModifiedDate  datetime  ,
    @ModifiedFlag  varchar(max)  ,
    @InteriorColorCode  varchar(50)  ,
    @ExteriorColorCode  varchar(50)  ,
    @PackageCode  varchar(50)  ,
    @CodedCost  varchar(50)  ,
    @Air  varchar(100)  ,
    @OrderType  varchar(max)  ,
    @AgeDays  bigint  ,
    @OutstandingRO  varchar(50)  ,
    @DlrAccessoryRetail  varchar(50)  ,
    @DlrAccessoryCost  varchar(max)  ,
    @DlrAccessoryDesc  varchar(max)  ,
    @ModelDesc  varchar(50)  ,
    @Memo1  varchar(1000)  ,
    @Memo2  varchar(max)  ,
    @Weight  varchar(max)  ,
    @FloorPlan  numeric(18, 2)  ,
    @Purchaser  varchar(max)  ,
    @PurchasedFrom  varchar(max)  ,
    @InternetPrice  varchar(50)  ,
    @InventoryAcctDollar  numeric(18, 2)  ,
    @VehicleType  varchar(50)  ,
    @DealerAccessoryCode  varchar(50)  ,
    @AllInventoryAcctDollar  numeric(18, 2)  ,
    @BestPrice  varchar(50)  ,
    @InStock  bigint  ,
    @AccountingMake  varchar(50)  ,
    @GasDiesel  varchar(max)  ,
    @BookValue  varchar(10)  ,
    @FactoryAccessoryDescription  varchar(max)  ,
    @TotalReturn  varchar(10)  ,
    @TotalCost  varchar(10)  ,
    @SS  varchar(max)  ,
    @VehicleBody  varchar(max)  ,
    @StandardEquipment  varchar(max)  ,
    @Account  varchar(max)  ,
    @CalculatedPrice  varchar(10)  ,
    @OriginalCost  varchar(10)  ,
    @AccessoryCore  varchar(10)  ,
    @OtherDollar  varchar(10)  ,
    @PrimaryBookValue  varchar(10)  ,
    @AmountDue  varchar(10)  ,
    @LicenseFee  varchar(10)  ,
    @ICompany  varchar(max)  ,
    @InvenAcct  varchar(max)  ,
    @Field23  varchar(max)  ,
    @Field24  varchar(max)  ,
    @SalesCode  varchar(max)  ,
    @BaseRetail  varchar(10)  ,
    @BaseInvAmt  varchar(10)  ,
    @CommPrice  varchar(10)  ,
    @Price1  varchar(10)  ,
    @Price2  varchar(10)  ,
    @StickerPrice  varchar(10)  ,
    @TotInvAmt  varchar(10)  ,
    @OptRetail  varchar(max)  ,
    @OptInvAmt  varchar(10)  ,
    @OptCost  varchar(10)  ,
    @Options  varchar(max)  ,
    @Category  varchar(max)  ,
    @Description  varchar(max)  ,
    @Engine  varchar(max)  ,
    @ModelType  varchar(max)  ,
    @FTCode  varchar(max)  ,
    @Wholesale  varchar(max)  ,
    @Retail  varchar(max)  ,
    @Draft  varchar(max)  ,
    @Inventoryid int;
    DECLARE Inventory_Cursor CURSOR FOR 
    SELECT * from [dbo].[FLATFILE_INVENTORY];
    OPEN Inventory_Cursor
    FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    WHILE @@FETCH_STATUS = 0
    BEGIN
        PRINT @VehicleVIN    ;
    -- ****************** insert into Inventory Table ***********
    INSERT INTO INVENTORY 
    IconicDealerID,
    StockNumber,
    DMSType,
    InventoryDate
    VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
    set @Inventoryid = scope_identity();
    PRINT @Inventoryid;
    --Insert into Inventory_Details Table
    INSERT INTO [INVENTORY_DETAILS]
    InventoryID,
    StockType,
    DMSStatus,
    LotLocation,
    TagLine,
    Certification,
    CertificationNumber,
    CreatedDate,
    LastModifiedDate,
    ModifiedFlag,
    PackageCode,
    OrderType,
    AgeDays,
    OutstandingRO,
    Memo1,
    Memo2,
    Purchaser,
    PurchasedFrom,
    DealerAccessoryCode,
    InStock,
    AccountingMake,
    SS,
    Account,
    AccessoryCore,
    ICompany,
    InvenAcct,
    Field23,
    Field24,
    SalesCode,
    Draft,
    FTCode
    VALUES (
    @InventoryID,
    @StockType,
    @DMSStatus,
    @LotLocation,
    @TagLine,
    @Certification,
    @CertificationNumber,
    @CreatedDate,
    @LastModifiedDate,
    @ModifiedFlag,
    @PackageCode,
    @OrderType,
    @AgeDays,
    @OutstandingRO,
    @Memo1,
    @Memo2,
    @Purchaser,
    @PurchasedFrom,
    @DealerAccessoryCode,
    @InStock,
    @AccountingMake,
    @SS,
    @Account,
    @AccessoryCore,
    @ICompany,
    @InvenAcct,
    @Field23,
    @Field24,
    @SalesCode,
    @Draft,
    @FTCode
    --Insert into Inventory_Amount Table
    INSERT INTO [dbo].[INVENTORY_AMOUNT]
    InventoryID,
    AllInventoryAcctDollar,
    OtherDollar,
    PrimaryBookValue,
    AmountDue,
    LicenseFee,
    CalculatedPrice,
    OriginalCost,
    BookValue,
    TotalReturn,
    TotalCost,
    DlrAccessoryRetail,
    DlrAccessoryCost,
    DlrAccessoryDesc,
    InternetPrice,
    InventoryAcctDollar,
    BestPrice,
    Weight,
    FloorPlan,
    CodedCost,
    InvoicePrice,
    CostPack,
    SalesCost,
    HoldbackAmount,
    ListPrice,
    MSRP,
    BaseRetail,
    BaseInvAmt,
    CommPrice,
    Price1,
    Price2,
    StickerPrice,
    TotInvAmt,
    OptRetail,
    OptInvAmt,
    OptCost,
    Wholesale,
    Retail
    VALUES (
    @InventoryID,
    @AllInventoryAcctDollar,
    @OtherDollar,
    @PrimaryBookValue,
    @AmountDue,
    @LicenseFee,
    @CalculatedPrice,
    @OriginalCost,
    @BookValue,
    @TotalReturn,
    @TotalCost,
    @DlrAccessoryRetail,
    @DlrAccessoryCost,
    @DlrAccessoryDesc,
    @InternetPrice,
    @InventoryAcctDollar,
    @BestPrice,
    @Weight,
    @FloorPlan,
    @CodedCost,
    @InvoicePrice,
    @CostPack,
    @SalesCost,
    @HoldbackAmount,
    @ListPrice,
    @MSRP,
    @BaseRetail,
    @BaseInvAmt,
    @CommPrice,
    @Price1,
    @Price2,
    @StickerPrice,
    @TotInvAmt,
    @OptRetail,
    @OptInvAmt,
    @OptCost,
    @Wholesale,
    @Retail
    --Insert into Inventory_Vehicle Table
    INSERT INTO [dbo].[INVENTORY_VEHICLE]
    InventoryID,
    InteriorColorCode,
    ExteriorColorCode,
    Air,
    ModelDesc,
    VehicleType,
    VehicleVIN,
    VehicleYear,
    VehicleMake,
    VehicleModel,
    VehicleModelCode,
    VehicleTrim,
    VehicleSubTrimLevel,
    Classification,
    TypeCode,
    VehicleMileage
    VALUES (
    @InventoryID,
    @InteriorColorCode,
    @ExteriorColorCode,
    @Air,
    @ModelDesc,
    @VehicleType,
    @VehicleVIN,
    @VehicleYear,
    @VehicleMake,
    @VehicleModel,
    @VehicleModelCode,
    @VehicleTrim,
    @VehicleSubTrimLevel,
    @Classification,
    @TypeCode,
    @VehicleMileage
    -- Move cursor to Next record 
        FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    END 
    CLOSE Inventory_Cursor;
    DEALLOCATE Inventory_Cursor;
    GO
    SET ANSI_PADDING OFF
    GO
    Arunraj Kumar

  • Selection in the master table is not getting reflected in the child table

    <p> I have a 4 level master detail relationship.I have a bounded taskflow where I have a master in the first view.The child (The other two levels as a tree) in the second view.I move to second view when i click the command link(Each row has a command link) of the master table (present in the first view).</p>
    <p>At the very first time when i try to insert a row in the child it's successful .I am able to see the same in the second view (The corresponding child of the master row which i have clicked).The 2 view is not refreshed i have panel strech layout in the 2 view which i am refreshing(PPR) on inserting the row. The master table is not refreshed as it is in the 1 view.I am not manipulating the master table but it was being set to the first row the second time .Added to that the 2 view doesn't have parent table .
    </p>
    Thanks,
    Raj.

    Hi Frank,
    I am using jdev 11.1.1.6 and integrated wls.
    I have a single taskflow.I have a 4 level master detail.The vo's are connected through a view link . I have dropped the first level as a table . On selecting a row the corresponding children are displayed.The children are displayed as a tree. I have a tree context menu where i have inserted a row using popup . When the user clicks on the ok dialog i am commiting the data and refreshing the tree.
    Now the problem is when i first create the row it's working properly . After when i try to create another row this time the currency of the first level is reset to the first row.
    As suggested by you i have tried disabling the commit opertion . But the issue still occurs.
    Thanks,
    Raj
    Edited by: RajaSekharReddy.M on Feb 26, 2013 6:03 PM

  • Why is the af:table tag creating a fixed size div.

    When I use the af:table components it seems to always occupy a fixed height no matter how many rows are displayed. This creates a difficulty when laying out pages and making the table scroll in a fixed area.
    I looked at the HTML and the div that wraps the table has a fixed height even when the actual data fits is a much smaller space. Can't the table just flow according to the wrapping container.
    Basically I would like to set the height of a layout container and have the table scroll without a bunch of "white space" at the bottom. Is this reasonable?
    I also tried to put the table in an af:panelBox that has a fixed height. When I do this the panelBox does not scroll it simply expands to contain the entire table. Event if I have a single row there is a bunch of white space below the last row. What layout control should I use to properly scroll a table?

    Hi,
    this came up couple of times and I'll file a bug to change this behavior. I agree that it doesn't make sense to not have the table responding to where it has less rows then the initial setting. However, this I think should be configurable because not everyone wants to have it.
    A reason for this behavior - and maybe a reason why this isn't an easy fix - is within the table rendring. The table rendering is through stamping, which means that the table itself doesn't perform active geometry handling. However. I'll file the bug and we se whats coming out of this
    Frank

  • How find the child tables

    hi
    is there a way(quesry) to find the list of child tables for a given tables.
    tried to query user_constraints and USER_CONS_COLUMNS, but not able to figure out a way.
    Thanks

    Hi,
    you can use query like following one - it'll list child tables and FK name for table HR.JOBS:
    select
    a.owner,a.table_name, a.constraint_name
    from sys.all_constraints a,
    (select owner,constraint_name from sys.all_constraints where owner = *'HR'* and table_name = *'JOBS'* and constraint_type in ('P','U')) b
    where
    a.constraint_type = 'R' and a.r_constraint_name = b.constraint_name and a.r_owner = b.owner
    if you don't need FK name, then put distinct:
    select
    distinct a.owner,a.table_name
    from sys.all_constraints a,
    (select owner,constraint_name from sys.all_constraints where owner = 'HR' and table_name = 'JOBS' and constraint_type in ('P','U')) b
    where
    a.constraint_type = 'R' and a.r_constraint_name = b.constraint_name and a.r_owner = b.owner
    Philip

  • Why does the work table have a 0 in the prefix? C$_0

    My phyiscal schema specifies that the mask (by default) should be C$. Does anyone know where the 0 is coming from?

    Hi Alastair,
    I'm using LKM File to Oracle (External Table), setting LKM option DELETE_TEMPORARY_OBJECTS to False, and I want to be able to refer to the created temporary table, $C_#table_name later in my package. However, I need from an application code standpoint to be able to guarantee the name of the External Table, i.e. what that # will be. Whether I can select it from a call method or from the repository or something; I just need to make sure what that number is always going to be so that my downstream processes don't fail in the reference. So what did you end up doing?

  • Why does the child class need to implement the parent classes constructor?/

    As I was playing around with some code I came across this point :
    First Class
    public class A {
         public int x;
         A(int i){
              x=i;
              System.out.println("A is initialised");
    }Second Class extending it :
    public class B extends A{
         private int y;
       // Why do I need this constructor to call parents constructor?
      // My guess is so that when i make an object of class B referring to class A it should make sense?
         B(int i) {                     
              super(i); 
              y=test;
    public static void main(String args[]){
          A a = new A(1);
          A b = new B(1); make an object of class B referring to class A it should work!!
          B c = new B(2);
          B d =(B) new A(2);  --> gives class cast exception!
    }I am little confused here, Can someone throw more light on it.
    Thanks

    You don't override constructors. However, every class, in it's constructor, must call some constructor from the class it's extending. In most cases this is simply super(). However, if your class does not have a default constructor (i.e. you've declared any other constructor, or the sub class does not have access to it, I.E. you've declared it private) then you must include a call to some other constructor in the super class. The constructor in the subclass does not have to be the same as the super class one, but you do have to invoke a constructor from the super class. I.E.
    class A {
      A(int i) {}
    class B extends A {
      B(String b) {
        super(0);
    }

  • In Mavericks iPhoto slide shows, why do the last pics come first, some pics are upside down, and some vertical pics are horizontal?  How can I fix this?

    On my iMac OSX, 10.9.4, Mavericks, I have been trying to view an album as a slide show.  The slide show starts at the end (bottom row picture) instead of the beginning (top 1st picture).  I have gone to View>Sort Photos>Manual.  But the order of Ascending and Descending choices are greyed out with the default check by Ascending.  How can I start at my beginning without rearranging all the photos?  Also, some of the photos are upside down and sideways, even though they are correct in the album.  How can I fix this??   Thank you!  Also, can I include a video in the slide show?  Up to how many seconds/minutes?

    Is this a slideshow created directly from an album?
    There's a bug with iPhoto 9.5 and Mavericks in that slideshows from Albums do not play correctly if they are sorted manually.  Only photos that have been sorted by date, keyword, rating or title will play from albums correctly.
    To have a slideshow with photos sorted manually use the slideshow mode in iPhoto.
    Send a bug report to Apple via http://www.apple.com/feedback/iphoto.html.

  • Need to increase performance-bulk collect in cursor with limit and in the for loop inserting into the trigger table

    Hi all,
    I have a performance issue in the below code,where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
    can someone please guide me here.Its bit urgent .Awaiting for your response.
    declare
    vmax_Value NUMBER(5);
      vcnt number(10);
      id_val number(20);
      pc_id number(15);
      vtable_nm VARCHAR2(100);
      vstep_no  VARCHAR2(10);
      vsql_code VARCHAR2(10);
      vsql_errm varchar2(200);
      vtarget_starttime timestamp;
      limit_in number :=10000;
      idx           number(10);
              cursor stg_cursor is
             select
                   DESCRIPTION,
                   SORT_CODE,
                   ACCOUNT_NUMBER,
                     to_number(to_char(CORRESPONDENCE_DATE,'DD')) crr_day,
                     to_char(CORRESPONDENCE_DATE,'MONTH') crr_month,
                     to_number(substr(to_char(CORRESPONDENCE_DATE,'DD-MON-YYYY'),8,4)) crr_year,
                   PARTY_ID,
                   GUID,
                   PAPERLESS_REF_IND,
                   PRODUCT_TYPE,
                   PRODUCT_BRAND,
                   PRODUCT_HELD_ID,
                   NOTIFICATION_PREF,
                   UNREAD_CORRES_PERIOD,
                   EMAIL_ID,
                   MOBILE_NUMBER,
                   TITLE,
                   SURNAME,
                   POSTCODE,
                   EVENT_TYPE,
                   PRIORITY_IND,
                   SUBJECT,
                   EXT_PRD_ID_TX,
                   EXT_PRD_HLD_ID_TX,
                   EXT_SYS_ID,
                   EXT_PTY_ID_TX,
                   ACCOUNT_TYPE_CD,
                   COM_PFR_TYP_TX,
                   COM_PFR_OPT_TX,
                   COM_PFR_RSN_CD
             from  table_stg;
    type rec_type is table of stg_rec_type index by pls_integer;
    v_rt_all_cols rec_type;
    BEGIN
      vstep_no   := '0';
      vmax_value := 0;
      vtarget_starttime := systimestamp;
      id_val    := 0;
      pc_id     := 0;
      success_flag := 0;
              vstep_no  := '1';
              vtable_nm := 'before cursor';
        OPEN stg_cursor;
              vstep_no  := '2';
              vtable_nm := 'After cursor';
       LOOP
              vstep_no  := '3';
              vtable_nm := 'before fetch';
    --loop
        FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
                  vstep_no  := '4';
                  vtable_nm := 'after fetch';
    --EXIT WHEN v_rt_all_cols.COUNT = 0;
        EXIT WHEN stg_cursor%NOTFOUND;
    FOR i IN 1 .. v_rt_all_cols.COUNT
      LOOP
       dbms_output.put_line(upper(v_rt_all_cols(i).event_type));
        if (upper(v_rt_all_cols(i).event_type) = upper('System_enforced')) then
                  vstep_no  := '4.1';
                  vtable_nm := 'before seq sel';
              select PC_SEQ.nextval into pc_id from dual;
                  vstep_no  := '4.2';
                  vtable_nm := 'before insert corres';
              INSERT INTO target1_tab
                           (ID,
                            PARTY_ID,
                            PRODUCT_BRAND,
                            SORT_CODE,
                            ACCOUNT_NUMBER,
                            EXT_PRD_ID_TX,         
                            EXT_PRD_HLD_ID_TX,
                            EXT_SYS_ID,
                            EXT_PTY_ID_TX,
                            ACCOUNT_TYPE_CD,
                            COM_PFR_TYP_TX,
                            COM_PFR_OPT_TX,
                            COM_PFR_RSN_CD,
                            status)
             VALUES
                            (pc_id,
                             v_rt_all_cols(i).party_id,
                             decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                             v_rt_all_cols(i).sort_code,
                             'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4),
                             v_rt_all_cols(i).EXT_PRD_ID_TX,
                             v_rt_all_cols(i).EXT_PRD_HLD_ID_TX,
                             v_rt_all_cols(i).EXT_SYS_ID,
                             v_rt_all_cols(i).EXT_PTY_ID_TX,
                             v_rt_all_cols(i).ACCOUNT_TYPE_CD,
                             v_rt_all_cols(i).COM_PFR_TYP_TX,
                             v_rt_all_cols(i).COM_PFR_OPT_TX,
                             v_rt_all_cols(i).COM_PFR_RSN_CD,
                             NULL);
                  vstep_no  := '4.3';
                  vtable_nm := 'after insert corres';
        else
              select COM_SEQ.nextval into id_val from dual;
                  vstep_no  := '6';
                  vtable_nm := 'before insertcomm';
          if (upper(v_rt_all_cols(i).event_type) = upper('REMINDER')) then
                vstep_no  := '6.01';
                  vtable_nm := 'after if insertcomm';
              insert into parent_tab
                 (ID ,
                 CTEM_CODE,
                 CHA_CODE,            
                 CT_CODE,                           
                 CONTACT_POINT_ID,             
                 SOURCE,
                 RECEIVED_DATE,                             
                 SEND_DATE,
                 RETRY_COUNT)
              values
                 (id_val,
                  lower(v_rt_all_cols(i).event_type), 
                  decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                  'Email',
                  v_rt_all_cols(i).email_id,
                  'IADAREMINDER',
                  systimestamp,
                  systimestamp,
                  0);  
         else
                vstep_no  := '6.02';
                  vtable_nm := 'after else insertcomm';
              insert into parent_tab
                 (ID ,
                 CTEM_CODE,
                 CHA_CODE,            
                 CT_CODE,                           
                 CONTACT_POINT_ID,             
                 SOURCE,
                 RECEIVED_DATE,                             
                 SEND_DATE,
                 RETRY_COUNT)
              values
                 (id_val,
                  lower(v_rt_all_cols(i).event_type), 
                  decode(v_rt_all_cols(i).product_brand,'LTB',2,'HLX',1,'HAL',1,'BOS',3,'VER',4,0),
                  'Email',
                  v_rt_all_cols(i).email_id,
                  'CORRESPONDENCE',
                  systimestamp,
                  systimestamp,
                  0); 
            END if; 
                  vstep_no  := '6.11';
                  vtable_nm := 'before chop';
             if (v_rt_all_cols(i).ACCOUNT_NUMBER is not null) then 
                      v_rt_all_cols(i).ACCOUNT_NUMBER := 'XXXX'||substr(trim(v_rt_all_cols(i).ACCOUNT_NUMBER),length(trim(v_rt_all_cols(i).ACCOUNT_NUMBER))-3,4);
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 'IB.Correspondence.AccountNumberMasked',
                 v_rt_all_cols(i).ACCOUNT_NUMBER);
             end if;
                  vstep_no  := '6.1';
                  vtable_nm := 'before stateday';
             if (v_rt_all_cols(i).crr_day is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Day',
                 'IB.Crsp.Date.Day',
                 v_rt_all_cols(i).crr_day);
             end if;
                  vstep_no  := '6.2';
                  vtable_nm := 'before statemth';
             if (v_rt_all_cols(i).crr_month is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Month',
                 'IB.Crsp.Date.Month',
                 v_rt_all_cols(i).crr_month);
             end if;
                  vstep_no  := '6.3';
                  vtable_nm := 'before stateyear';
             if (v_rt_all_cols(i).crr_year is not null) then 
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)
              values
                (id_val,
                 --'IB.Correspondence.Date.Year',
                 'IB.Crsp.Date.Year',
                 v_rt_all_cols(i).crr_year);
             end if;
                  vstep_no  := '7';
                  vtable_nm := 'before type';
               if (v_rt_all_cols(i).product_type is not null) then
                  insert into child_tab
                     (COM_ID,                                            
                     KEY,                                                                                                                                        
                     VALUE)
                  values
                    (id_val,
                     'IB.Product.ProductName',
                   v_rt_all_cols(i).product_type);
                end if;
                  vstep_no  := '9';
                  vtable_nm := 'before title';         
              if (trim(v_rt_all_cols(i).title) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE )
              values
                (id_val,
                 'IB.Customer.Title',
                 trim(v_rt_all_cols(i).title));
              end if;
                  vstep_no  := '10';
                  vtable_nm := 'before surname';
              if (v_rt_all_cols(i).surname is not null) then
                insert into child_tab
                   (COM_ID,                                            
                   KEY,                                                                                                                                          
                   VALUE)
                values
                  (id_val,
                  'IB.Customer.LastName',
                  v_rt_all_cols(i).surname);
              end if;
                            vstep_no  := '12';
                            vtable_nm := 'before postcd';
              if (trim(v_rt_all_cols(i).POSTCODE) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Customer.Addr.PostCodeMasked',
                  substr(replace(v_rt_all_cols(i).POSTCODE,' ',''),length(replace(v_rt_all_cols(i).POSTCODE,' ',''))-2,3));
              end if;
                            vstep_no  := '13';
                            vtable_nm := 'before subject';
              if (trim(v_rt_all_cols(i).SUBJECT) is not null) then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Correspondence.Subject',
                  v_rt_all_cols(i).subject);
              end if;
                            vstep_no  := '14';
                            vtable_nm := 'before inactivity';
              if (trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) is null or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '3' or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '6' or
                  trim(v_rt_all_cols(i).UNREAD_CORRES_PERIOD) = '9') then
              insert into child_tab
                 (COM_ID,                                            
                 KEY,                                                                                                                                            
                 VALUE)                              
               values
                (id_val,
                 'IB.Correspondence.Inactivity',
                  v_rt_all_cols(i).UNREAD_CORRES_PERIOD);
              end if;
                          vstep_no  := '14.1';
                          vtable_nm := 'after notfound';
        end if;
                          vstep_no  := '15';
                          vtable_nm := 'after notfound';
        END LOOP;
        end loop;
                          vstep_no  := '16';
                          vtable_nm := 'before closecur';
        CLOSE stg_cursor;
                          vstep_no  := '17';
                          vtable_nm := 'before commit';
        DELETE FROM table_stg;
      COMMIT;
                          vstep_no  := '18';
                          vtable_nm := 'after commit';
    EXCEPTION
    WHEN OTHERS THEN
      ROLLBACK;
      success_flag := 1;
      vsql_code := SQLCODE;
      vsql_errm := SUBSTR(sqlerrm,1,200);
      error_logging_pkg.inserterrorlog('samp',vsql_code,vsql_errm, vtable_nm,vstep_no);
      RAISE_APPLICATION_ERROR (-20011, 'samp '||vstep_no||' SQLERRM:'||SQLERRM);
    end;
    Thanks

    Its bit urgent
    NO - it is NOT urgent. Not to us.
    If you have an urgent problem you need to hire a consultant.
    I have a performance issue in the below code,
    Maybe you do and maybe you don't. How are we to really know? You haven't posted ANYTHING indicating that a performance issue exists. Please read the FAQ for how to post a tuning request and the info you need to provide. First and foremost you have to post SOMETHING that actually shows that a performance issue exists. Troubleshooting requires FACTS not just a subjective opinion.
    where i am trying to insert the data from table_stg into target_tab and in parent_tab tables and then to child tables via cursor with bulk collect .the target_tab and parent_tab are huge tables and have a row wise trigger enabled on it .the trigger is mandatory . This timetaken for this block to execute is 5000 seconds.Now my requirement is to reduce it to 5 to 10 mins.
    Personally I think 5000 seconds (about 1 hr 20 minutes) is very fast for processing 800 trillion rows of data into parent and child tables. Why do you think that is slow?
    Your code has several major flaws that need to be corrected before you can even determine what, if anything, needs to be tuned.
    This code has the EXIT statement at the beginning of the loop instead of at the end
        FETCH stg_cursor BULK COLLECT INTO v_rt_all_cols LIMIT limit_in;
                  vstep_no  := '4';
                  vtable_nm := 'after fetch';
    --EXIT WHEN v_rt_all_cols.COUNT = 0;
        EXIT WHEN stg_cursor%NOTFOUND;
    The correct place for the %NOTFOUND test when using BULK COLLECT is at the END of the loop; that is, the last statement in the loop.
    You can use a COUNT test at the start of the loop but ironically you have commented it out and have now done it wrong. Either move the NOTFOUND test to the end of the loop or remove it and uncomment the COUNT test.
    WHEN OTHERS THEN
      ROLLBACK;
    That basically says you don't even care what problem occurs or whether the problem is for a single record of your 10,000 in the collection. You pretty much just throw away any stack trace and substitute your own message.
    Your code also has NO exception handling for any of the individual steps or blocks of code.
    The code you posted also begs the question of why you are using NAME=VALUE pairs for child data rows? Why aren't you using a standard relational table for this data?
    As others have noted you are using slow-by-slow (row by row processing). Let's assume that PL/SQL, the bulk collect and row-by-row is actually necessary.
    Then you should be constructing the parent and child records into collections and then inserting them in BULK using FORALL.
    1. Create a collection for the new parent rows
    2. Create a collection for the new child rows
    3. For each set of LIMIT source row data
      a. empty the parent and child collections
      b. populate those collections with new parent/child data
      c. bulk insert the parent collection into the parent table
      d. bulk insert the child collection into the child table
    And unless you really want to either load EVERYTHING or abandon everything you should use bulk exception handling so that the clean data gets processed and only the dirty data gets rejected.

  • SQL Server 2012 Management Studio:In the Database, how to print out or export the old 3 dbo Tables that were created manually and they have a relationship for 1 Parent table and 2 Child tables?How to handle this relationship in creating a new XML Schema?

    Hi all,
    Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
    Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
    Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
    Problem #1) How can I print out or export these 3 dbo Tables?
    Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service. 
    --> Failed to retrieve data for this request. --> Invalid class.  Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
    to manage a service. --> Failed to retrieve data for this request. --> Invalid class.  .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates>   What causes this set of error messages? How can
    I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
    Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
    Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
    Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
    Thanks in advance,
    Scott Chang    

    In the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
    1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
    2) I don't know why you get that error, but any particular reason you want to run PowerShell?
    4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
    As for left/right join, notice that these two are equivalent:
    SELECT ...
    FROM   a LEFT JOIN b ON a.col = b.col
    SELECT ...
    FROM   b RIGHT JOIN a ON a.col = b.col
    But please never use RIGHT JOIN - it gives me a headache!
    There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
    Here is an example where you can study the different join types and how they behave:
    CREATE TABLE apple (a int         NOT NULL PRIMARY KEY,
                        b varchar(23) NOT NULL)
    INSERT apple(a, b)
       VALUES(1, 'Granny Smith'),
             (2, 'Gloster'),
             (4, 'Ingrid-Marie'),
             (5, 'Milenga')
    CREATE TABLE orange(c int        NOT NULL PRIMARY KEY,
                        d varchar(23) NOT NULL)
    INSERT orange(c, d)
       VALUES(1, 'Agent'),
             (3, 'Netherlands'),
             (4, 'Revolution')
    SELECT a, b, c, d
    FROM   apple
    CROSS  JOIN orange
    SELECT a, b, c, d
    FROM   apple
    INNER  JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    LEFT   OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    RIGHT  OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    FULL OUTER JOIN orange ON apple.a = orange.c
    go
    DROP TABLE apple, orange
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Do all folios in a multi folio app need to be related?

    I am working on an idea with my company to produce book apps for one of our publishing branches. We want to offer interactive book apps which have more interactivity than an ebook or epub3 would have, but would have too little interactivity to pass A

  • Playing other than Quicktime mov files

    How do I get Quicktime to play Windows Media files in a full screen mode. I have the Flip forMac plug in but can't figure out how to change the settings to full screen mode. I also downloaded Windows Media Player 9 but can't figure out how to get fil

  • How to control the data to display for every users?

    Hello Experts, Im creating a module in ORACLE forms6i and I want to control all the data to display for every USERs. I have 1 Table and it has 5 columns. My module has 5 columns and 5 rows of records to display. Problems: For USER1, I want to display

  • Want to deactivate a line but was told I wold lose Grandfathered.

    I recently called Verizon wanting to deactivate a line. It happens to be a dumb phone and is no longer needed in the plan. The phone is basic, no data, no current contract, just a simple phone. I was told that if I dropped the phone from the plan and

  • Error in grouping

    Hello sir, I am having issue: The followings are the departments in organization: E-gov Embedded NLP These departments are having projects. Resources for these projects are Grant in aid Sponsored projects Other sponsored Projects Academic projects Bu