Query on a child/parent Table

Heya!
I searched google and this forum, but couldn't get any answers, so i hope to get help by opening a new thread..
I got a Table, like this: CARS , with the columns NAME, CARID, CARPARENT
Possible Data in the Table
NAME--------- CARID--------- CARPARENT
all_modells------0---------------------NULL
Mercedes-------1----------------------0
E-Klasse---------2-----------------------1
Classic-----------3-----------------------2
Audi--------------4-----------------------0
A4----------------5-----------------------4
(Hope ths shows what im talking about..)
Now to my question:
I'd like to have an SQL Query / or PL/SQL that will give me the following results:
Mercedes // E-Klasse // Classic
Audi........// A4........// (nothing shall show here, so empty)
Is there a nice way to do this? I think the problem is , that not every entry in the table has an equal number of parents in it..
A little help would be nice!
thank you,
byebye.. verena!

Hi,
Looks like another form of string aggregation.
See: http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:124812348063
and use the search functionality on this forum.
If that doesn't get you going, please provide a create table statement + insert statements.
Post your examples between the tag. See the [FAQ|http://forums.oracle.com/forums/help.jspa] for an explanation regarding tags.
(And always mention your DB-version)
Edited by: hoek on Nov 27, 2009 12:17 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Query/join/where/child parent table

    query/join/where/child parent table
    hello my query below is not working for my cf application can
    you help?
    thanks
    this is my previous question so i tried to do it my self.
    tcase_req.tcase_req_id is added
    tcase.case_id=tcase_req.case_id :note that this is not part of the
    inner join in the from clause. it does not depend on the rest of
    the inner join.
    the reaon for this is that i need to get
    WHERE tcase_req.case_req_typ_cd = cwc and
    tcase_req.case_req_typ_cd = cwnc
    here is the original question
    Hello ,
    I need help again on the inner join/and conditions in the
    where clause
    I have these 2 tables tcase and tcase_req where there common
    field Is the case_id.
    tcase is the parent table and the tcase_req is the child
    table.
    (1)I wanted to add this to the from clause using the inner
    join table . what do I do and where do I put it
    (2)I then need to put a condition in the where clause to
    replace
    WHERE TCASE.CASE_NBR Like '%HPOZ%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
    by
    WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
    '%CWNC%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
    Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
    is this efficient??
    thanks
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id,
    tcase_req.case_req_typ_cd
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE TCASE.CASE_NBR Like '%CWC%'and
    tcase.case_id=tcase_req.case_id
    (3)To a tcase_req
    Suffix_id are equal to = cwc and cwnc ( in the tcase_req
    table)(Suffix_id is the field that cintains the suffix cwc and cwnc
    for the tcase_req)
    also,
    this is the original query and it works fine
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE_NBR Like
    '%CWNC%')

    query/join/where/child parent table
    hello my query below is not working for my cf application can
    you help?
    thanks
    this is my previous question so i tried to do it my self.
    tcase_req.tcase_req_id is added
    tcase.case_id=tcase_req.case_id :note that this is not part of the
    inner join in the from clause. it does not depend on the rest of
    the inner join.
    the reaon for this is that i need to get
    WHERE tcase_req.case_req_typ_cd = cwc and
    tcase_req.case_req_typ_cd = cwnc
    here is the original question
    Hello ,
    I need help again on the inner join/and conditions in the
    where clause
    I have these 2 tables tcase and tcase_req where there common
    field Is the case_id.
    tcase is the parent table and the tcase_req is the child
    table.
    (1)I wanted to add this to the from clause using the inner
    join table . what do I do and where do I put it
    (2)I then need to put a condition in the where clause to
    replace
    WHERE TCASE.CASE_NBR Like '%HPOZ%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-HPOZ-CCMP'
    by
    WHERE TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE _NBR Like
    '%CWNC%'
    AND TCASE.CASE_NBR = 'DIR-2004-4269-CWC'
    Or TCASE.CASE_NBR = 'DIR-2004-4269-CWNC'
    is this efficient??
    thanks
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id,
    tcase_req.case_req_typ_cd
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE TCASE.CASE_NBR Like '%CWC%'and
    tcase.case_id=tcase_req.case_id
    (3)To a tcase_req
    Suffix_id are equal to = cwc and cwnc ( in the tcase_req
    table)(Suffix_id is the field that cintains the suffix cwc and cwnc
    for the tcase_req)
    also,
    this is the original query and it works fine
    SELECT TLA_PROP.PIN,
    TLA_PROP.ASSR_PRCL_NBR,
    TCASE.CASE_NBR,
    TLA_PROP.STR_NBR,
    TLA_PROP.STR_NBR_RNG_END,
    TLA_PROP.STR_FRAC_NBR,
    Tref_plan_area.plan_area_desc,
    TLA_PROP.STR_FRAC_NBR_RNG_END,
    TLA_PROP.STR_DIR_CD,
    TLA_PROP.STR_NM,
    TLA_PROP.STR_SFX_CD,
    TLA_PROP.STR_SFX_DIR_CD,
    TLA_PROP.STR_UNIT_TYP_CD,
    TLA_PROP.UNIT_NBR,
    TLA_PROP.UNIT_NBR_RNG_END,
    TLA_PROP.ZIP_CD,
    TLA_PROP.ZIP_CD_SFX,
    TLA_PROP.CNCL_DIST_NBR,
    TLA_PROP.PLAN_AREA_NBR,
    TLA_PROP.ZONE_REG_CD,
    TAPLC.PROJ_DESC_TXT,
    TCASE.CASE_ID,
    TCASE.CASE_NBR,
    taplc.aplc_id
    FROM TLA_PROP INNER JOIN tref_plan_area ON
    tla_prop.plan_area_nbr = tref_plan_area.plan_area_NBR INNER JOIN
    TLOC ON TLA_PROP.PROP_ID = TLOC.LOC_ID INNER JOIN TAPLC ON
    TLOC.APLC_ID = TAPLC.APLC_ID INNER JOIN TCASE ON TAPLC.APLC_ID =
    TCASE.APLC_ID
    WHERE (TCASE.CASE_NBR Like '%CWC%' or TCASE.CASE_NBR Like
    '%CWNC%')

  • 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

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

  • Join  a Parent Table with 2 Child table based on a value

    Dear Guru's
    We have a Parent Table and 2 Child table . The Parent Table has a column like seqtype with only 2 possible values C and S . If the Value is C , then the details are available in Child 1 table and if the Value is S then the Details are in Child 2 table
    How can we query the Data from this type of arrangement ? I am little bit confused and hit a road block
    Will the following query will work ?
    Select
    from Parent P , Child C1, Child C2
    where P.seqtype = C1.Seqtype
    and P.seqtype = C2.Seqtype
    With Warm Regards
    ssr

    You didn't mention the column names in two child tables. Whether the columns are same in 2 tables of these are different.
    If the columns are same better to go and change your design to have only one child table. However if stiil business stops you having one table you can use UNION ALL (Assuming you want to fetch same column information from two child tables) like below:
    SELECT p.col1
          ,c1.col2
          ,c1.col3
          ,c1.col4
      FROM parent     p
          ,child      c1
    WHERE p.seqtype = c1.seqtype
    UNION ALL
    SELECT p.col1
          ,c2.col2
          ,c2.col3
          ,c2.col4
      FROM parent     p
          ,child      c2
    WHERE p.seqtype = c2.seqtype Regards
    Arun

  • Sql server partition parent table and reference not partition child table

     
    Hi,
    I have two tables in SQL Server 2008 R2, Parent and Child Table.  
    Parent has date time, and it is partitioned monthly,  there is a Child table which just refer the Parent table using Foreign key relation.   
    is there any problem the non-partitioned child table referring to a partitioned parent table?
    Thanks,
    Areef

    The tables will need to be offline for the operation. "Offline" here, means that you wrap the entire operation in a transaction. Ideally, this transaction would:
    1) Drop the foreign key.
    2) Use ALTER TABLE SWITCH to drop the old data.
    3) Use ALTER PARTITION FUNCTION to drop the old empty partition.
    4) Use ALTER PARTITION FUNCTION to add a new empty partition.
    5) Reapply the foreign keys WITH CHECK.
    All but the last operation are metadata-only operation (provided that you do them right). To perform the last operation, SQL Server must scan the child tbale and verify that all keys are present in the parent table. This can take some time for larger tables.
    During the transaction, SQL Server holds Sch-M locks on the table, which means that are entirely inaccessible, even for queries running with NOLOCK.
    You avoid this the scan by applying the fkey constraint WITH NOCHECK, but this can have impact on query plans, as SQL Server will not consider the constraint as trusted.
    An alternative which should not be entirely dismissed is to use partitioned
    views instead. With partitioned views, the foreign keys are not an issue, because each partition is a pair of tables, with its own local fkey.
    As for the second question: it appears to be completely pointless to partition the parent, but not the child table. Or does the child table only have rows for a smaller set of the rows in the parent?
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Deleting records from child to parent table

    I have ran into a situation where i will have to delete all the records of the child table and then the records of parent table and i was able to write a query to get the column,table both for parent,child and stuck up in deleting them using query and
    i will not be able to use Cascade...My validation criteria is applicable for the child tables and parent table...am trying to compare last modified date of each table...Kindly help me with an approach
    DECLARE @mytable VARCHAR(30) SET @mytable = 'tablea'
    DECLARE @Order INT SET @Order = 0
    DECLARE @Count INT
    declare @tblname varchar(100),@query NVARCHAR(max),@parent varchar(100)
    if OBJECT_ID('tempdb..#OrderList','U') is not null
    DROP TABLE #OrderList
    if OBJECT_ID('tempdb..#temp','U') is not null
    DROP TABLE #temp
    CREATE TABLE #TEMP
    OrderNo INT,
    TableName VARCHAR(50),
    tid varchar(100),
    childtable varchar(100),
    cid varchar(100)
    CREATE TABLE #OrderList
    RecordNo INT,
    OrderNo INT,
    TableName VARCHAR(50),
    tid varchar(100),
    childtable varchar(100),
    cid varchar(100)
    create table #t
    taname varchar(100)
    ;with tempcte (level,parent,pcol,child,ccol)
    as
    SELECT 0,SO2.name, SC2.name,SO1.name, SC1.name
    FROM dbo.sysforeignkeys FK
    INNER JOIN dbo.syscolumns SC1
    ON FK.fkeyid = SC1.id AND FK.fkey = SC1.colid
    INNER JOIN dbo.syscolumns SC2
    ON FK.rkeyid = SC2.id AND FK.rkey = SC2.colid
    INNER JOIN dbo.sysobjects SO1
    ON FK.fkeyid = SO1.id
    INNER JOIN dbo.sysobjects SO2
    ON FK.rkeyid = SO2.id
    INNER JOIN dbo.sysobjects FO
    ON FK.constid = FO.id
    WHERE SO2.Name = 'tablea'
    union all
    SELECT level+1,SO2.name, SC2.name,SO1.name, SC1.name
    FROM dbo.sysforeignkeys FK
    INNER JOIN dbo.syscolumns SC1
    ON FK.fkeyid = SC1.id AND FK.fkey = SC1.colid
    INNER JOIN dbo.syscolumns SC2
    ON FK.rkeyid = SC2.id AND FK.rkey = SC2.colid
    INNER JOIN dbo.sysobjects SO1
    ON FK.fkeyid = SO1.id
    INNER JOIN dbo.sysobjects SO2
    ON FK.rkeyid = SO2.id
    INNER JOIN dbo.sysobjects FO
    ON FK.constid = FO.id
    inner join tempcte t
    on SO2.Name = t.child
    insert into #TEMP
    OrderNo,
    TableName,
    tid,
    childtable,
    cid
    select
    level,parent,pcol,child,ccol from tempcte
    select * from #TEMP
    INSERT INTO #OrderList
    SELECT Row_number() OVER (ORDER BY OrderNo, TableName),
    #TEMP.OrderNo,
    #TEMP.TableName,
    #TEMP.tid,
    #temp.childtable,
    #TEMP.cid
    FROM #TEMP
    SET @Count = (SELECT Max(RecordNo)
    FROM #OrderList)
    select * from #OrderList

    Am looking for a logic to delete the records..Please provide some query to better understand..
    Thats easy, refer the below link: You may check string and then execute if everything looks ok to you.
    Ref:http://social.msdn.microsoft.com/Forums/en-US/bc36c6b6-1aca-43aa-bc95-7518fdb6fe4c/delete-data-from-multiple-tables?forum=transactsql
    declare @Deletecommand varchar(max)
    ;with object_cte(tblid,tblname,rtblid,rtblname,level)
    as
    select distinct o.object_id as tblid,OBJECT_NAME(o.object_id) as tblname,cast(null as int),cast(null as sysname),
    0 as level
    from sys.objects o
    inner join sys.foreign_keys f
    on f.parent_object_id = o.object_id
    where o.is_ms_shipped=0
    and o.type='u' and OBJECT_NAME(o.object_id) like '/BIO/A%'
    union all
    select t.object_id as tblid,OBJECT_NAME(t.object_id) as tblname,o.tblid,o.tblname,o.level + 1
    from object_cte o
    inner join sys.foreign_keys f
    on f.parent_object_id = o.tblid
    join sys.objects t
    on t.object_id = f.referenced_object_id
    where t.is_ms_shipped=0
    and t.type='u'
    and OBJECT_NAME(o.object_id) like '/BIO/A%'
    select @Deletecommand =(select 'DELETE FROM ' + tblname + ';' from
    select row_Number() over (partition by tblname order by level) as rn,* from object_cte
    )t
    where rn=1
    order by level
    for xml path(''))
    print @Deletecommand
    --exec (@Deletecommand)

  • Query to delete both parent and child record....

    hai.........
    I tried to delete a record from the table.... but i get a error saying 'child record' exist cannot delete record'.... can u plz tell me the query to delete both parent and child record....
    plz help me.....
    anoo...

    Hello,
    Is already answered in {thread:id=824593}. Please mark the question as answered.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Parent child relation tables

    Hi experts,
    Please check it my code . in this procedure first cursor only inserted into t1 temp table not inserted second cursor please check it and modified the my code.
    i want inserted parent child relation table like bellow
    parent child
    a b
    a c
    a d
    b l
    b m
    b n
    c d like that only inserted
    PROCEDURE TEST_PARENTS_CHILD( p_TABLE VARCHAR2)
    IS
    CURSOR c(P_TABLE varchar2)
    IS
    SELECT p.table_name PARENT, c.table_name CHILD
    FROM user_constraints p, user_constraints c
    WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
    AND c.constraint_type = 'R'
    AND p.constraint_name = c.r_constraint_name
    AND p.table_name = P_TABLE;
    CURSOR C1(p_child varchar2) IS SELECT p.table_name PARENT_TABLE, c.table_name CHILD_TABLE
    FROM user_constraints p, user_constraints c
    WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
    AND c.constraint_type = 'R'
    AND p.constraint_name = c.r_constraint_name
    AND p.table_name = P_CHILD;
    type array
    IS
    TABLE OF T1%ROWTYPE INDEX BY PLS_INTEGER;
    t_data ARRAY;
    BEGIN
    FOR I IN C(P_TABLE)
    LOOP
    FETCH C bulk collect INTO T_DATA limit 1000;
    --- EXIT WHEN C%NOTFOUND;
    FORALL I IN 1..T_DATA.last
    INSERT INTO T1 VALUES T_DATA(I);
    FOR J IN C1(i.CHILD)
    LOOP
    FETCH C1 BULK COLLECT INTO T_DATA LIMIT 1000;
    --EXIT
    --WHEN C1%NOTFOUND;
    FORALL j IN 1..T_DATA.last
    INSERT INTO T1 VALUES T_DATA(j);
    end loop;
    END LOOP;
    END TEST_PARENTS_CHILD;
    Regards,
    Venkat

    You've been asked before on your previous questions (all of which still appear to be unanswered) to read the FAQ: {message:id=9360002} and post correct details of your question, and use {noformat}{noformat} tags to preserve your code/data formatting on the forum.
    But still you post a question lacking all the information and formatting.  If you can't be bothered to help us understand your issue (and read your code), why do you expect others will be bothered to try and help you?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to check that my table is parent table or child table before trucating

    Hi:
    say i wanted to trucate a table .the table might be a parent table or might be a child table.if its a child table then there wouldnt be any problems in truncating.
    if its a parent table the i believe i would have to diable all the foreign key constraints from the child table referring to the parent table ..my question is
    1. i have a table say ABC. before truncating how do i find out if table ABC is a parent table or not?
    2.lets assume i tried to truncate the table ABC and i got the error saying that disable the foreign keys on the child table referring to the parent table ABC.
    in my schema there are say 50 tables.out of which there might be 10 odd child tables referring to my parent table ABC.
    so my question here would be how do i specifically find out these 10child tables referring to the Parent table ABC so that i can disable the foreign keys on the child tables.
    Thanks 4 ur time in reading this and hopefully i think u wld give me a solution!!

    Hi,
    Try this SQL below:
    select r.owner, r.table_name
    from user_constraints r, user_constraints o
    where r.r_owner = o.owner and r.r_constraint_name = o.constraint_name
    and o.constraint_type in ('P','U') and r.constraint_type = 'R'
    and o.table_name = 'ABC';Cheers

  • How to delete parent table data even though it has child records

    hi all,
    How to delete parent table data even though it has child records.
    ex: delete from pa_request cascade constraints;
    But this command is not working .
    Regards,
    P Prakash

    833560 wrote:
    ex: delete from pa_request cascade constraints;cascade constraints is DROP table option. It can't be used with DELETE. You need to delete child rows first or drop foreign keys and recreate them with ON DELETE CASCADE. Then:
    delete from pa_request will automatically delete child rows. However, personally I don't like ON DELETE CASCADE. You can, by mistake, delete half of your database without even realizing it.
    SY.

  • Parent table of a child table

    I am using a child table 'CHILD_T' and in this table the column 'CHILD_FK' is the foreign key and it is pointing to some parent table. In my oracle editor I can see only synonyms but not actual tables. Is there any way to find out the parent table for this child table. Why I am asking this is because , I am getting below error while trying to execute the below script.
    Here I think my question is pretty simple but I would like to know how to find a parent table of a child table as I can see only synonyms instead actual tables.
    Script :
    INSERT INTO CHILD_T ( EM_ID, DFLT_COST_CNTR_TXT, ACCT_TYP_ID, DFLT_ORD_TYP_ID ) VALUES ('abcd', 'NA', '1', '1' );
    Error:
    SQL Error: ORA-02291: integrity constraint (AFM.USR_PROF_EM_ID) violated - parent key not found.
    Any one have any idea your help is well appreciated.

    select table_name  from user_constraints where constraint_name  in
        (select r_constraint_name from user_constraints  where constraint_name='YOUR_CONSTARINT_NAME');

  • Query the name of the parent table in a foreign key constraint

    Hello,
    Does anyone know how to query for the parent table name in a foreign key constraint? I don't see that relationship in ALL_CONS_COLUMNS or ALL_CONSTRAINTS.
    Thanks in advance,
    Michael

    or try this...
    SELECT rc.TABLE_NAME "PK_Table_Name",cc.TABLE_NAME "FK_Table_Name",
           case when cc.column_name = rc.column_name
                then c.TABLE_NAME || '(' || cc.COLUMN_NAME || ')'
                else r.TABLE_NAME || '(' || rc.COLUMN_NAME || ') = ' ||c.TABLE_NAME || '(' || cc.COLUMN_NAME || ')' end as "TABLE_NAME(COLUMN_NAME)"
    from all_constraints c,
         all_constraints r,
         all_cons_columns cc,
         all_cons_columns rc
    WHERE
         r.table_name = upper('emp')
    and      c.CONSTRAINT_TYPE = 'R'
    and     c.R_OWNER = r.OWNER
    and     c.R_CONSTRAINT_NAME = r.CONSTRAINT_NAME
    and     c.CONSTRAINT_NAME = cc.CONSTRAINT_NAME
    and     c.OWNER = cc.OWNER
    and     r.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
    and     r.OWNER = rc.OWNER
    and     cc.POSITION = rc.POSITION
    ORDER BY r.TABLE_NAME;

  • How to update parent and child tables while updating parent table

    I have a parent table EMPLOYEE which includes columns (sysid, serviceno,employeename...) sysid is Primary key, serviceno is Unique key and I have child table DEPENDENT includes columns (sysid,employee_sysid,name,dob...) here again SYSID is primary key for DEPENDENTS table, employee_sysid is Foreign key of EMPLOYEE table.
    Now I want to change SYSID (using sequence) in EMPLOYEE table which need to be update in DEPENDENTS table as well
    Note: I have 10000 records in EMPLOYEE table as well as I have 5 more child tables which need to update new SYSID.
    please help me

    first disable the FOREIGN KEY Constraints.
    you can update Parent as well as Child record also with help of trigger.
    here i am giving you one examlpe..it may help u.
    create table parent(id number primary key,name varchar2(100))
    create table child_1(id number primary key,p_id number,dob date,
    CONSTRAINT FK_id FOREIGN KEY (p_id) REFERENCES parent (ID))
    create table child_2(id number primary key,p_id2 number,addr varchar2(1000),
    CONSTRAINT FK_id2 FOREIGN KEY (p_id2) REFERENCES parent (ID))
    insert some test data to parent and child tables.
    alter table child_2 disable constraint FK_id2
    alter table child_1 disable constraint FK_id2
    CREATE OR REPLACE TRIGGER delete_child
    BEFORE UPDATE ON parent
    FOR EACH ROW
    BEGIN
    UPDATE CHILD_1
    SET P_ID=:NEW.ID
    WHERE P_ID=:OLD.ID;
    UPDATE CHILD_2
    SET P_ID2 =:NEW.ID
    WHERE P_ID2=:OLD.ID;
    END;
    then Upadte parent table primary key col and check the child tables.
    then enable the constraints...

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

Maybe you are looking for

  • Startup delay

    I left my mac off over the weekend. When I came in this morning to start it up, the main bootup screen came on with the apple logo, then after two or so minutes, a question mark replaced the logo with the bar pinwheel rotating over and over again. I

  • New release for Muse

    I had an update for Muse today, but am unable to find any release notes for it. Anyone else received an update notification via CC?

  • Built-in mic not recognized by system

    When I try to record with the built in mic on my macbook on Windows Vista, I go to the sound settings and under the recording tab the computer will have a microphone icon but it will say "currently available" and won't let me make it a default record

  • Access very large objects using servlets from database

    hai, Please suggest me to access a very large object, for example an image file, from the database using servlets. Thanks! null

  • Update the embedded field

    we have following problem: class A has class B as embedded attribute. If we write: tx1: a = readA(); tx2: a.b.setName("new Name"); makePersistent(a) the changes in field "name" will not be saved. If we write: tx2: a.b = new B("new Name"); makePersist