FK as PK in Child tables

I have an employee table and three tables as child of employee table
1. Instructors
2. Airmen
3. Examiners
FK from employes is acting as Primary key in child tables and relationship is identifying.
how could i restrict empID(FK) not to copy in three tables. I mean an employee cant be Instructor, Airmen , Examiner at same time . I am not sure if relationship is wrong or there is any other solution.

how could i post you table structures i mean DB model if that is possible it would be great favor as i want expert comment on this. do u have any email or how i can send u JPEG file.

Similar Messages

  • Retrieving all FK from child table in a resultset

    I have a parent and its child table.In child table there are many records containing the same PK of the parent as a foreign key(one to many relationship).Now how can I get all those values (in a resultset) of child table containing the same FK .The code i produced can fetch the first record of the same PK of the parent.But how can I get all with a single SQl statement and iterate through them as necessary.
    String sql1="SELECT * FROM ChildTableName WHERE id= ' 100 ' ; //100 is the PK of Parent table // there are many records in Child Table having 100 as foreign key resultset = statement.executeQuery(sql1); resultset .next();      try{          System.out.println("Data> "+resultset.getString(1));         System.out.println("Data> "+resultset.getString(2));         System.out.println("Data> "+resultset.getString(3));   }catch(SQLException sqle){System.out.println("ERROR REFRESH : " + sqle); }{code} Edited by: Tanvir007 on Apr 17, 2008 4:35 AM Edited by: Tanvir007 on Apr 17, 2008 4:37 AM Edited by: Tanvir007 on Apr 17, 2008 4:40 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    duffymo wrote:
    First of all,ARE U BLIND brother, didn't you see what I wrote-
    String sql= "SELECT Flat_Rent.rent_id,Flat_Rent.flat_name FROM Month_Rent INNER JOIN Flat_Rent ON Month_Rent.rent_id = Flat_Rent.rent_id WHERE Flat_Rent.rent_id = '4-2008'" ;      
    Actually, I did see that. It makes me wonder why you were asking in the first place and what the problem is now.In the first place, I didnt use join,I did it later as u advised.But u asked me later about the join.Why?
    >
    People who have empty catch blocks are fools. If you don't want to be one, log or print the stack trace. It's good information to have, and it'll help you avoid problems in the future.People are fools for many reasons LIKE - even if I told u that I can retrieve record (but only the first record),there is no question of throwing an exception.And I DID fill catch block in the first place,look back.Later, it wasnt that much necessary bcos no exception throws at all.
    However brother many thanks for an attempt to help me.I think I have solved the problem-
    try{
    String sql= "SELECT flat_name,flat_rent,elec_bill FROM Month_Rent INNER JOIN Flat_Rent ON Month_Rent.rent_id = Flat_Rent.rent_id WHERE Flat_Rent.rent_id = '4-2008'" ;      
                             resultset = statement.executeQuery(sql);               
                             resultset .next();
                             do
                                  System.out.println("Flat Name>> " + resultset .getString(1));
                                  System.out.println("Rent>> " + resultset .getString(2));
                                  System.out.println("Elec Bill>> " + resultset .getString(3));
                             while(rs.next());
                        }catch(SQLException sqle){ sqle.printStackTrace();           }But the problem is, The fields in my DB are in this serial- rent_id,flat_name,flat_rent,elec_reading,elec_bill,total_rent,status
    But as you can see from the code that I get the Flat name in 1,Rent in 2 and bill in 3 which should be 2,3,5 respectively.Can you tell me why it is so?

  • Problem with Master and Child table

    Hi,
    Working in jdev 11.1.1.2.0. I have one strange issue. i have master and child tables, the model is working fine with the view link. but when drag drop the same into my jsff. when i query the result 1st time 2 tables are refershing properly and data is coming. but the when i trying to select another row in the 1st table my 2nd table(child table) is not refreshing.
    i put partial trigger of the 2nd table as 1st table id.
    can any one help wht is issue here.
    Edited by: user5802014 on Jul 15, 2010 3:44 PM

    Check this post might help you
    http://baigsorcl.blogspot.com/2010/03/creating-master-detail-form-in-adf.html

  • Custom Report Layout with mutliple child tables

    I am trying to create a custom report layout (using Bi Publisher) where I have parent data (multiple jobs on a page) and several child tables for each job (JobDays and JobStops) and several child tables for JobDays (JobDayProviders, JobDayCrew). On the apex screen, I have a join on Jobs and JobDays and I am using functions to string each child row value for JobDayProviders and JobDayCrew together and putting a <br> in between so that they will format on separate lines within a cell. It works fine on the screen but when trying to print to pdf, it ignores these line breaks. I have also tried using <br></br> (saw an article that said just use HTML in bi pulisher) which puts two lines in between each value on the screen and is still ignored on the pdf.
    for example:
    Table hierarchy:
    Jobs table
    Job Stops
    Job Days
    Job Day Service Providers
    Job Day Crew
    Report Layout per job (will have mutlipe jobs to print, just printing 1 day per job):
    Jobs.col1 JobStops.row1 JobDay.col1 JobDayProviders.row1 JobDayCrew.r1
    JobStops.row2 JobDayProviders.row2 JobDayCrew.r2
    JobDayProviders.row3
    Thanks,
    Linda
    First, is there a way to get bi publisher to recognize the line breaks? If not, what is the best way to create a custom report for this scenario? I tried to create a report query with mutliple queries, but cannot determine how to link the child queries to the paren query. I have seen an example where a button is pressed to print one parent row and the id of that row is saved and referenced as a parameter in each of the queries, but if printing mutliple parents on a report, how would I link the child queries to the parent query?

    Helen,
    The best way for your case is to use a content folder and customize it whichever way you like.
    however, your question is about reports. the problem in reports is this that you have to use just one single query and the layout of the results of this query are displayed in a peculiar way.
    anyway. something similar but not exactly the same as what you wanted do is the following.
    use a query like the following: (with a union in between)
    SELECT COLUMN1,NULL , NULL ,NULL ,NULL
    FROM my_source_table
    WHERE myCriteria LIKE 'SoAndSo%'
    UNION
    SELECT NULL,COLUMN2 , COLUMN3, COLUMN4, COLUMN5
    FROM my_source_table
    WHERE myCriteria LIKE 'SoAndSo%'
    ---------- Now, have the following codes in the layout segments:
    <!--- header --->
    <table border="0" cellpadding="1" cellspacing="1" width="20%" align="center">
    <!--- body --->
    <tr align="center">
    <td><table border="0" cellpadding="1" cellspacing="0" width="30%" align="center">
    <tr align="center">
    <TH><#COLUMN1.FIELD#></TH>
    </tr>
    </table>
    </td>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN2.FIELD#></TD>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN3.FIELD#></TD>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN4.FIELD#></TD>
    <TD class="report_cell" ALIGN="LEFT"><#COLUMN5.FIELD#></TD>
    </tr>
    <!--- footer --->
    <TR><TD></TD></TR>
    this should produce a report with a table structure (you may see the whole if you give BORDER="1" in the main table tag). Within this table, the first column of the first row should be showing top-leftmost column value once (COLUMN1 value) and then the next rows would show last four column values as a table block on the right-bottom part.
    with kind regards,
    naqvi

  • Master Child tables how to get the latest rows from both

    Hi,
    Need some help with the sql. I have two tables Master & Child. In my Master table I have multiple rows for the same record and in the child table also multiple rows for the same master row how can I get the latest one's from both.
    For example Data in my Master table looks like
    CONT_ID                  SEQ_NUM        DESCRIPTION
    1                         189             Update 2
    1                         188             Update 1
    1                         187              NewNow in the child table for the same CONT_ID I may have the following rows
    CONT_ID                   UPDATED_DATE                                     STATUS
    1                        3/16/2010 2:19:01.552700 PM                          P
    1                        3/16/2010 12:29:01.552700 PM                         A
    1                        3/16/2010 12:29:01.552700 PM                         P
    1                        3/16/2010 12:19:01.552700 PM                         NIn my final query how can I get the row with seq_num 189 as it's the latest in Master table and from child table the row with status of P as it's the latest one based on the time. Here is the query i have but it returns the latest row from the child table only and basically repeats the master table rows as opposed to one row that is latest from both:
    Thanks

    Hi,
    You can use the analytic ROW_NUMKBER function to find the latest row for each cont_id in each table:
    WITH     got_m_rnum     AS
         SELECT     cont_id,     seq_num,     description
         ,     ROW_NUMBER () OVER ( PARTITION BY  cont_id
                                   ORDER BY          seq_num     DESC
                           ) AS m_rnum
         FROM    master_table
    --     WHERE     ...     -- any filtering goes here
    ,     got_c_rnum     AS
         SELECT     cont_id, updated_date,     status
         ,     ROW_NUMBER () OVER ( PARTITION BY  cont_id
                                   ORDER BY          updated_date     DESC
                           ) AS c_rnum
         FROM    child_table
    --     WHERE     ...     -- any filtering goes here
    SELECT     m.cont_id,     m.seq_num,     m.description
    ,     c.updated_date,     c.status
    FROM     got_m_rnum     m
    JOIN     got_c_rnum     c     ON     m.cont_id     = c.cont_id
                        AND     m.m_rnum     = c.c_rnum
                        AND     m.m_rnum     = 1
    ;If you'd like to post CREATE TABLE and INSERT statements for the sample data, then I could test this.
    If there happens to be a tie for the latest row (say, there are only two rows in the child_table with a certain cont_id, and both have exactly the same updated_date), then this query will arbitrarily choose one of them as the latest.

  • 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

  • UPDATE of column in parent only UPDATEs first row in DENORMALIZED child table

    In the Repositiry in Designer 6i, I denormalized DESC1 column to
    pull the value of DESC1 in the parent table. The child table has
    four (4) records with matching foreign keys. When I go into my
    Form and update DESC1 in the parent, only the first of the four
    child DESC1's are updated. Any ideas?
    Thanks,
    Dan

    Dan,
    Sorry, known bug, but should be fixed in next release.
    Have a look via metalink at article <Note:156833.1> this
    explains in detail the problem and a fix.
    The bug no was <1974122>
    regards
    David

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

  • How do I include/show data from a child table in a Modal Window?

    How do I show data from a child table in a Modal Window?
    I have an application where each customer might have multiple addresses and phone numbers which are stored in child tables.  When I show the customer in a record on a screen I can place a Modal Window button on the screen which can be pushed at runtime
    to display detail information for the particular customer parent table which works great. However, I would also like to display the data from the address and phone number child tables. Is there a way to do that?  Or can I just launch a hole separate screen
    which would automatically display the needed data for the particular customer? If yes, how? 
    Thank you for any help.

    I am not even sure how to describe my situation in such a way that this forum incident would be of benefit to other people as I think it is fairly unconventional. 
    The “add contactaddress” link does not show up on the right.  
    The contactaddress table is a child of the contact table. 
    The contact table is a child of the contactlink table.
    And the contactlink table is a child of the person table.
    I have it set up this way because the contact in the contact table may be a contact to multiple persons in the person table and I do not want to re-enter the contact info every time the contact is used. 
    In the list detail screen of the person table I can see the contactlink child collection so that I can see the name of the person in the contact table at runtime. However, the contactaddress collection is not related to the person table so it does not show
    up on the right hand side of the design screen as an “add contactaddress”; nor is there “add contact” link.
    What I would like to happen during runtime is that it is not necessary to switch screens from the person list detail screen to a contact list detail screen to see the addresses and phone numbers for the contact.
     Is my setup unnecessarily convoluted? Is there a better way? Please see the two snapshots below.
    Perhaps there is a way to call up a Detail screen from the List Detail at runtime? 
    Anyway, if you are still reading, thank you very much for your help.   
    jjjjj

  • Delete the parent records and child table records at a time

    hi all;
    I am facing the pbm like to delete the all records in child table and corresponding records in parent table at a time. so I want to delete the all the records in child table and corresponding parent records in parent table by using single SQL query. plz help me
    Thanks in advance

    You want to use one single SQL statement to delete the child records in a table and the corresponding master records in the master table??
    That's not quite possible with a single SQL, of course unless you are talking about Oracle Forms, where you have a relation and set the delete behavior to Cascading, like said in the above posts.
    Tony

  • View cluster table child table calling problem!

    Hi All,
    I have created a cluster table with one table as header and one as item...
    Header table : ZRAJ1
    ITEM TABLE : ZRAJ2
    ZRAJ1 :
    ZPRODUCT
    ZPROD_DESC
    ZSTATUS
    ZUSER
    ZRAJ2:
    ZPRODUCT
    ZLABEL
    This clearly shows that zraj2 is depending on ZRAJ1.
    Created a cluster with these two tables.
    Also, created events for ZRAJ1.
    EVENT 05:
    FORM create_entry.
      yraj1-zuser = sy-uname.
    ENDFORM.
    EVENT 02:
    FORM after_save.
      IF yraj1-zstatus = 'L'.
        CALL TRANSACTION 'ZRAJ_VIEW'.
      ENDIF.
    ENDFORM.
    If the Zstatus is "L" in ZRAJ1, a new transaction will be called to maintain the child table zraj2.
    Trasnaction 'ZRAJ_VIEW'.
    REPORT 'ZRAJ_VIEW'.
    INITIALIZATION.
    *declaration:
      DATA : itab LIKE vimsellist OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
    *To call the MAintanence screen directly through the program:
      CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
        EXPORTING
          action                               = 'S'
      CORR_NUMBER                          = ' '
      GENERATE_MAINT_TOOL_IF_MISSING       = ' '
      SHOW_SELECTION_POPUP                 = ' '
          view_name                            = 'YRAJ2'
      NO_WARNING_FOR_CLIENTINDEP           = ' '
      RFC_DESTINATION_FOR_UPGRADE          = ' '
      CLIENT_FOR_UPGRADE                   = ' '
      VARIANT_FOR_SELECTION                = ' '
      COMPLEX_SELCONDS_USED                = ' '
       TABLES
          dba_sellist                          = itab
      EXCL_CUA_FUNCT                       =
    EXCEPTIONS
      CLIENT_REFERENCE                     = 1
      FOREIGN_LOCK                         = 2
      INVALID_ACTION                       = 3
      NO_CLIENTINDEPENDENT_AUTH            = 4
      NO_DATABASE_FUNCTION                 = 5
      NO_EDITOR_FUNCTION                   = 6
      NO_SHOW_AUTH                         = 7
      NO_TVDIR_ENTRY                       = 8
      NO_UPD_AUTH                          = 9
      ONLY_SHOW_ALLOWED                    = 10
      SYSTEM_FAILURE                       = 11
      UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
      VIEW_NOT_FOUND                       = 13
      OTHERS                               = 14
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    it is calling, ok no issues but it is not allowing me to create a new entry in the child table zraj2.
    Error: Table is locked by the user Raj.Checked in SM12 yes there is an lock entry for the table zrst(cluster),  zraj1, zraj2.
    Question :
    By default in the execution of cluster will there be a lock in all the child table as well.
    if so how to create new entries....
    For your information : Standalone it is working fine.That is if i execute ZRAJ1 in SM31 i am able to create new entries..
    Can any one provide some input on this............
    Tahnks,
    raj.

    I don't know any direct transaction for your purpose, but you can use this program RSTXSCRP to download your form into the local file and than you can open it to view.
    Regards,
    Naimesh Patel

  • Insert Record with Parent/Child Tables doesn't work with Oracle - unlike AC

    Hi,
    I just Migrated a MS Access 2010 Database to an Oracle 11g Backend with the SQL Developer Tool.
    The Migration went fine, all the Tables and Views are migrated.
    I'm working with MS Access as Frontend.
    The application has some Datasheets with Subdatasheets with Parent/Child Relationship. (1-n Relationship)
    After changing to Oracle, it's not possible, to Insert a new Record in a Subdatasheet I always get the following Error Message:
    "The Microsoft Access database engine cannot find a record in the table 'xxxx' with key matching field(s) 'zzzzz'"
    It used to work perfect with the MS Access Backend, do I need a trigger which first adds the child Record ?
    Or what should I do?
    Thank you

    Hi Klaus,
    Thanks for your answer. I still haven't solved my problem. The only way would be to use a singel 1:n Relationship, but in fact I need a n:m Relationship.
    I tried the same scenario with a new Access Application, same result.
    To clearify my problem.
    Goal: Parent Form with Parent Records, Linked Child Form with Child Records in a Datasheet View => Insert of a NEW Child Record.
    I have 3 Tables (table1 = Parent tabel, table2 = Child Table, table12 = n:m Tabel with PK and two FK)
    The Recordsource of the Parent Form is Tabel1
    The Recordsource of the Child Form is Table2 joined with Table12.
    In my Old Access Project, Access Triggered the Insert and filled Table12 with the NEW PK of Table2.
    It seems like Access can't do that anymore....
    I'm pretty desperate and I'm sure it is just a litte thing to fix.....

  • How to find the level of each child table in a relational model?

    Earthlings,
    I need your help and I know that, 'yes, we can change'. Change this thread to a answered question.
    So: How to find the level of each child table in a relational model?
    I have a relacional database (9.2), all right?!
         O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
        /↑\ Fks
       O"O O" <-- level 2 for first table (circle)
      /↑\ Fks
    "o"o"o" <-- level 1 for middle table (circle)
       ↑ Fk
      "º"Tips:
    - each circle represents a table;
    - red tables no have foreign key
    - the table in first line of tree, for example, has level 3, but when 3 becomes N? How much is N? This's the question.
    I started thinking about the following:
    First I have to know how to take the children:
    select distinct child.table_name child
      from all_cons_columns father
      join all_cons_columns child
    using (owner, position)
      join (select child.owner,
                   child.constraint_name fk,
                   child.table_name child,
                   child.r_constraint_name pk,
                   father.table_name father
              from all_constraints father, all_constraints child
             where child.r_owner = father.owner
               and child.r_constraint_name = father.constraint_name
               and father.constraint_type in ('P', 'U')
               and child.constraint_type = 'R'
               and child.owner = 'OWNER') aux
    using (owner)
    where child.constraint_name = aux.fk
       and child.table_name = aux.child
       and father.constraint_name = aux.pk
       and father.table_name = aux.father;Thinking...
    Let's Share!
    My thanks in advance,
    Philips
    Edited by: BluShadow on 01-Apr-2011 15:08
    formatted the code and the hierarchy for readbility

    Justin,
    Understood.
    Nocycle not work in 9.2 and, even that would work, would not be appropriate.
    With your help, I decided a much simpler way (but there is still a small problem, <font color=red>IN RED</font>):
    -- 1
    declare
      type udt_roles is table of varchar2(30) index by pls_integer;
      cRoles udt_roles;
    begin
      execute immediate 'create user philips
        identified by philips';
      select granted_role bulk collect
        into cRoles
        from user_role_privs
       where username = user;
      for i in cRoles.first .. cRoles.count loop
        execute immediate 'grant ' || cRoles(i) || ' to philips';
      end loop;
    end;
    -- 2
    create table philips.root1(root1_id number,
                               constraint root1_id_pk primary key(root1_id)
                               enable);
    grant all on philips.root1 to philips;
    create or replace trigger philips.tgr_root1
       before delete or insert or update on philips.root1
       begin
         null;
       end;
    create table philips.root2(root2_id number,
                               constraint root2_id_pk primary key(root2_id)
                               enable);
    grant all on philips.root2 to philips;
    create or replace trigger philips.tgr_root2
       before delete or insert or update on philips.root2
       begin
         null;
       end;
    create table philips.node1(node1_id number,
                               root1_id number,
                               node2_id number,
                               node4_id number,
                               constraint node1_id_pk primary key(node1_id)
                               enable,
                               constraint n1_r1_id_fk foreign key(root1_id)
                               references philips.root1(root1_id) enable,
                               constraint n1_n2_id_fk foreign key(node2_id)
                               references philips.node2(node2_id) enable,
                               constraint n1_n4_id_fk foreign key(node4_id)
                               references philips.node4(node4_id) enable);
    grant all on philips.node1 to philips;
    create or replace trigger philips.tgr_node1
       before delete or insert or update on philips.node1
       begin
         null;
       end;
    create table philips.node2(node2_id number,
                               root1_id number,
                               node3_id number,
                               constraint node2_id_pk primary key(node2_id)
                               enable,
                               constraint n2_r1_id_fk foreign key(root1_id)
                               references philips.root1(root1_id) enable,
                               constraint n2_n3_id_fk foreign key(node3_id)
                               references philips.node3(node3_id) enable);
    grant all on philips.node2 to philips;
    create or replace trigger philips.tgr_node2
       before delete or insert or update on philips.node2
       begin
         null;
       end;                          
    create table philips.node3(node3_id number,
                               root2_id number,
                               constraint node3_id_pk primary key(node3_id)
                               enable,
                               constraint n3_r2_id_fk foreign key(root2_id)
                               references philips.root2(root2_id) enable);
    grant all on philips.node3 to philips;
    create or replace trigger philips.tgr_node3
       before delete or insert or update on philips.node3
       begin
         null;
       end;                          
    create table philips.node4(node4_id number,
                               node2_id number,
                               constraint node4_id_pk primary key(node4_id)
                               enable,
                               constraint n4_n2_id_fk foreign key(node2_id)
                               references philips.node2(node2_id) enable);
    grant all on philips.node4 to philips;
    create or replace trigger philips.tgr_node4
       before delete or insert or update on philips.node4
       begin
         null;
       end;                          
    -- out of the relational model
    create table philips.node5(node5_id number,
                               constraint node5_id_pk primary key(node5_id)
                               enable);
    grant all on philips.node5 to philips;
    create or replace trigger philips.tgr_node5
       before delete or insert or update on philips.node5
       begin
         null;
       end;
    -- 3
    create table philips.dictionary(table_name varchar2(30));
    insert into philips.dictionary values ('ROOT1');
    insert into philips.dictionary values ('ROOT2');
    insert into philips.dictionary values ('NODE1');
    insert into philips.dictionary values ('NODE2');
    insert into philips.dictionary values ('NODE3');
    insert into philips.dictionary values ('NODE4');
    insert into philips.dictionary values ('NODE5');
    --4
    create or replace package body philips.pck_restore_philips as
      procedure sp_select_tables is
        aExportTablesPhilips     utl_file.file_type := null; -- file to write DDL of tables   
        aExportReferencesPhilips utl_file.file_type := null; -- file to write DDL of references
        aExportIndexesPhilips    utl_file.file_type := null; -- file to write DDL of indexes
        aExportGrantsPhilips     utl_file.file_type := null; -- file to write DDL of grants
        aExportTriggersPhilips   utl_file.file_type := null; -- file to write DDL of triggers
        sDirectory               varchar2(100) := '/app/oracle/admin/tace/utlfile'; -- directory \\bmduhom01or02 
        cTables                  udt_tables; -- collection to store table names for the relational depth
      begin
        -- omits all referential constraints:
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'REF_CONSTRAINTS', false);
        -- omits segment attributes (physical attributes, storage attributes, tablespace, logging):
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SEGMENT_ATTRIBUTES', false);
        -- append a SQL terminator (; or /) to each DDL statement:
        dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'SQLTERMINATOR', true);
        -- create/open files for export DDL:
        aExportTablesPhilips := utl_file.fopen(sDirectory, 'DDLTablesPhilips.pdc', 'w', 32767);
        aExportReferencesPhilips := utl_file.fopen(sDirectory, 'DDLReferencesPhilips.pdc', 'w', 32767);
        aExportIndexesPhilips := utl_file.fopen(sDirectory, 'DDLIndexesPhilips.pdc', 'w', 32767);
        aExportGrantsPhilips := utl_file.fopen(sDirectory, 'DDLGrantsPhilips.pdc', 'w', 32767);
        aExportTriggersPhilips := utl_file.fopen(sDirectory, 'DDLTriggersPhilips.pdc', 'w', 32767);
        select d.table_name bulk collect
          into cTables -- collection with the names of tables in the schema philips
          from all_tables t, philips.dictionary d
         where owner = 'PHILIPS'
           and t.table_name = d.table_name;
        -- execution
        sp_seeks_ddl(aExportTablesPhilips,
                     aExportReferencesPhilips,
                     aExportIndexesPhilips,
                     aExportGrantsPhilips,
                     aExportTriggersPhilips,
                     cTables);
        -- closes all files
        utl_file.fclose_all;
      end sp_select_tables;
      procedure sp_seeks_ddl(aExportTablesPhilips     in utl_file.file_type,
                             aExportReferencesPhilips in utl_file.file_type,
                             aExportIndexesPhilips    in utl_file.file_type,
                             aExportGrantsPhilips     in utl_file.file_type,
                             aExportTriggersPhilips   in utl_file.file_type,
                             cTables                  in out nocopy udt_tables) is
        cDDL       clob := null; -- colletion to save DDL
        plIndex    pls_integer := null;
        sTableName varchar(30) := null;
      begin
        for i in cTables.first .. cTables.count loop
          plIndex    := i;
          sTableName := cTables(plIndex);
           * Retrieves the DDL and the dependent DDL into cDDL clob       *      
          * for the selected table in the collection, and writes to file.*
          begin
            cDDL := dbms_metadata.get_ddl('TABLE', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportTablesPHILIPS, cDDL);
          exception
            when dbms_metadata.object_not_found then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('REF_CONSTRAINT', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportReferencesPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportIndexesPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('OBJECT_GRANT', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportGrantsPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
          begin
            cDDL := dbms_metadata.get_dependent_ddl('TRIGGER', sTableName, 'PHILIPS');
            sp_writes_ddl(aExportTriggersPhilips, cDDL);
          exception
            when dbms_metadata.object_not_found2 then
              null;
          end;
        end loop;
      end sp_seeks_ddl;
      procedure sp_writes_ddl(aExport in utl_file.file_type,
                              cDDL    in out nocopy clob) is
        pLengthDDL  pls_integer := length(cDDL);
        plQuotient  pls_integer := null;
        plRemainder pls_integer := null;
      begin
          * Register variables to control the amount of lines needed   *
         * for each DDL and the remaining characters to the last row. *
        select trunc(pLengthDDL / 32766), mod(pLengthDDL, 32766)
          into plQuotient, plRemainder
          from dual;
          * Join DDL in the export file.                            *
         * ps. 32766 characters + 1 character for each line break. *
        -- if the size of the DDL is greater than or equal to limit the line ...
        if plQuotient >= 1 then
          -- loops for substring (lines of 32766 characters + 1 break character):
          for i in 1 .. plQuotient loop
            utl_file.put_line(aExport, substr(cDDL, 1, 32766));
            -- removes the last line, of clob, recorded in the buffer:
            cDDL := substr(cDDL, 32767, length(cDDL) - 32766);
          end loop;
        end if;
          * If any remains or the number of characters is less than the threshold (quotient = 0), *
         * no need to substring.                                                                 *
        if plRemainder > 0 then
          utl_file.put_line(aExport, cDDL);
        end if;
        -- record DDL buffered in the export file:
        utl_file.fflush(aExport);
      end sp_writes_ddl;
    begin
      -- executes main procedure:
      sp_select_tables;
    end pck_restore_philips;<font color="red">The problem is that I still have ...
    When creating the primary key index is created and this is repeated in the file indexes.
    How to avoid?</font>

  • Selecting Lists/Grids From a Child Table

    If I have a parent table "Patient" it has two product tables (Parent Table related 1 <--to--> Many Child Tables) and I make a screen for One Child Table so that it gives me a selection box for the parent table. I can already then
    show on the screen properties of the patient from the table I selected. Can I also bring up a List or Grid of the Other Child Table based on the patient I selected?

    I don't want to display something in the grid. I want to show all of the entries in that grid for a certain person. I want to grab the grid as a control showing all of the properties in a grid not showing them as individual labels or text etc....
    I am not on that entity I am on the orders entity it is already related to the customer to do that to get customer data. The Customer entity/table is related to the allergies entity which is related to Medications to pull up the names of drugs the customer
    is allergic too. I want to pull up the whole grid of allergies as a grid I solved this for now by making a single property on the patient table and grabbing all of the rows for a particular patient. then making them one field. I cannot however grab them as
    a table and have the advantage of the UI of the grid or list functions.

  • Perfomance Issue on Parent Child table SQL

    I am having table a and child table b contains data and message .
    both are linked with id column. how can i pick the latest message from b against id . how can we make fastest sql.
    I tried with subquries but it is taking time and working slow.
    When i checking the cost of the sql in plan it is showing more than which i am expecting
    Edited by: SA123 on Jun 22, 2009 3:22 PM

    Old Structure output
    PLAN_TABLE_OUTPUT                                   
    | 0 | SELECT STATEMENT | | 194 | 149K|                                   
    591 (7)| 00:00:08 |                                   
    | 1 | SORT ORDER BY | | 194 | 149K|                                   
    591 (7)| 00:00:08 |                                   
    |* 2 | HASH JOIN | | 194 | 149K|                                   
    590 (7)| 00:00:08 |                                   
    |* 3 | HASH JOIN RIGHT OUTER | | 192 | 142K|                                   
    504 (8)| 00:00:07 |                                   
    PLAN_TABLE_OUTPUT                                   
    | 4 | VIEW | | 5 | 2535 |                                   
    288 (4)| 00:00:04 |                                   
    |* 5 | FILTER | | | |                                   
    | |                                   
    | 6 | HASH GROUP BY | | 5 | 570 |                                   
    288 (4)| 00:00:04 |                                   
    |* 7 | HASH JOIN | | 32116 | 3575K|                                   
    PLAN_TABLE_OUTPUT                                   
    283 (2)| 00:00:04 |                                   
    | 8 | TABLE ACCESS FULL | b | 31837 | 373K|                                   
    141 (2)| 00:00:02 |                                   
    | 9 | TABLE ACCESS FULL | b | 31837 | 3171K|                                   
    141 (2)| 00:00:02 |                                   
    | 10 | NESTED LOOPS | | 192 | 48768 |                                   
    216 (13)| 00:00:03 |          
    New Structure
    PLAN_TABLE_OUTPUT
    | 0 | SELECT STATEMENT | | 196 | 152K|
    | 1108 (4)| 00:00:14 |
    | 1 | SORT ORDER BY | | 196 | 152K|
    | 1108 (4)| 00:00:14 |
    |* 2 | HASH JOIN | | 196 | 152K|
    | 1107 (4)| 00:00:14 |
    |* 3 | HASH JOIN | | 193 | 145K|
    | 1021 (4)| 00:00:13 |
    PLAN_TABLE_OUTPUT
    | 4 | NESTED LOOPS | | 192 | 48192 |
    | 216 (13)| 00:00:03 |
    |* 5 | HASH JOIN | | 3832 | 419K|
    | 206 (11)| 00:00:03 |

  • Cascade update of primary key in child tables

    Hi,
    We have a typical scenario in which the primary key has to propage to the child table into 3 levels. We are getting the no parent key exception if we create new data into the three tables using 3 level master detail relationship and execute commit operation. The following is the structure of the tables.
    Parent_table (sno number primary key, name varchar2(100));
    Child_table (fk_sno number primary key, name varchar2(100), foreign key (fk_sno) references parent_table(sno));
    GrandChild_table (sno number primary key, fk_sno number, name varchar2(100), foreign key (fk_sno) references Child_table(fk_sno));
    The requirement is to update fk_sno in child_table and grandchild_table with the trigger generated primary key sno in the parent_table.
    The application module is having the following structure
    parenttable
    |
    ----------childtable
    |
    -----------grandchild_table
    If we create new records into parent_table and child_table it is working fine when we commit the data. If we create another record into grandchild_table and commit data we are getting the foreign key violation exception. We are using composition in the association to update the modified values to refresh the data.
    Is there any problem in the data model to use fk_sno as primary key and foreign key in child_table.
    Thanks and Regards,
    S R Prasad

    Hmm, another example is CSKS, this logic was probably designed already in the 1980s...maybe it was seen beneficial to be able to select the currently valid record by using the primary key only (the first record where DATBI is larger than system date, not possible when DATAB is the key instead).
    Maybe there are better explanations. Why do you need to know this, just curious?
    Thomas

Maybe you are looking for

  • Adobe Air Download Problem

    Changed password.  Still not accepted in downloading Adobe Air

  • What is the correct charger for the new iPad Air 2?

    Our new iPad Air 2 came with a 10Watt charger. Went to the apple store to get a spare. The Apple folk insist the 12 watt unit is what it needs  - sold my will two. Just trying to figure out which is correct for a new Model= 'MGKL2LL/A' iPad Air 2. Th

  • Advance oracle apps installion help needed

    dear all, have 5 sun servers and i want to do the follwoing installation on them. -db node (shared node) on one server. -3 web/froms servers to hold the web and forms and the other components.( i will have 3 web and 3 froms servers on the 3 server).

  • Help me out pls....................

    Hi, Can any body let me know how to use for all entries for three tables (payr,bsik,rfpdo)... plsssssssssssssssssss reply soon..... rgds mallika

  • Can't get internet

    I've got three computers on my home network and on one of them I can't get the internet to work. This machine is running 10.3.9 and I've tried safari and firefox. The machine in question is able to access the network fine and sys prefs says that it's