How get Child records

Hi,
In my Table 'Assem' contains Both child records and parent records in column name as Part_number.
Description of table "Assem" is:
Object Id:
Partnumber:
PartName:
Mastr_Objectid.
Object is a id of Both master and child. Master_objectid is Only id for Master numbers.
I given query Like this(self join)....
select a.partnumber parent_part,b.partnumber child_part
from Assem a,Assem b
where b.materid=b.objectid;
But Only Master Records only fetched.
pls guide me.
Regards,
Venkat.

if master table recods id is
1
2
3
4
child table contain:
1
2
3
4
a1
a2
a3
Heare a1,a2,a3 are child.
So,
That condition fetched 1 2 3 4 Recodes in the both tables. But i need child also.
Venkat.

Similar Messages

  • How get all record from master and matching record from detail

    hi master
    sir i have master detail table
    i have many record in master table but some record in detail table how i get
    all record from master and matching record from detail
    such as
    select m.accid,m.title,d.dr,d.cr from master m, detail d where m.accid=d.accid
    this query not work that get only related record i need all record from master
    please give me idea
    thanking you
    aamir

    hi master
    sir i have master detail table
    i have many record in master table but some record in
    detail table how i get
    all record from master and matching record from
    detail
    such as
    select m.accid,m.title,d.dr,d.cr from master m,
    detail d where m.accid=d.accid
    this query not work that get only related record i
    need all record from master
    please give me idea
    thanking you
    aamir
    select m.accid,m.title,d.dr,d.cr
    from master m, detail d
    where m.accid=d.accid (+)The outer join operator (+) will get you all the details from master and any details from the detail if they exist, but the master details will still be got even if there are not details.
    Note: Oracle 10g now supports ANSI standard outer joins as in:
    select m.accid,m.title,d.dr,d.cr
    from master m LEFT OUTER JOIN detail d on m.accid=d.accid

  • How can i get the id of the last child record in hierarchical data

    I want to get the lastest child record  of the parents like 
    the result   
    If I Select A then the result should be  'C' , 'E' , 'F' , 'G'
    If i select D then the result should be 'F' etc
    Thanks
    USE [SMEDB]
    GO
    /****** Object:  Table [dbo].[Table_3]    Script Date: 11/26/2014 2:10:49 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Table_3](
    [ID] [nvarchar](50) NULL,
    [ParentID] [nvarchar](50) NULL
    ) ON [PRIMARY]
    GO
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'A', NULL)
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'B', N'A')
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'C', N'D')
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'D', N'A')
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'E', N'D')
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'F', N'E')
    INSERT [dbo].[Table_3] ([ID], [ParentID]) VALUES (N'G', N'A')

    WITH cte(ID, ParentID, Lvl, HPath)
    AS (
           SELECT ID,
                  ParentID,
                  0,
                  CAST(ID AS VARCHAR(MAX)) + '\' AS HPath
           FROM   dbo.[Table_3]
           WHERE  ID ='D'
           UNION ALL
           SELECT        e.ID,
                         e.ParentID,
                         m.Lvl + 1 AS Lvl,
                         m.HPath +CAST(e.ID AS VARCHAR(MAX))+ '\'  AS HPath
           FROM          dbo.[Table_3] AS e
           INNER JOIN    cte AS m ON m.ID = e.ParentID
    ),cte1
    AS
    SELECT HPath,id,Parentid,lvl,
    RIGHT(LEFT(HPath,LEN(HPath)-1),CHARINDEX('\',REVERSE(LEFT(HPath,LEN(HPath))))) lst
    FROM   cte WHERE lvl>0
    ) SELECT lst FROM cte1 WHERE NOT EXISTS (SELECT * FROM cte1 c WHERE c.ParentID=cte1.lst)
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to update child record when item from parent record changes

    Hi, I have a master and detail form with two regions on the same page.
    Region one references parent record, one of column in the parent record is also in the child record. And is one to many relation
    between parent record and child record. How can I have the column on the child record updated when the column of the parent record is being modified?
    For exemple; Parent record has two columns : ID and Program.
    Child record has Program, goal# and status. I have two pages established, page 27 and page 28.
    Page 27 list out all programs from parent record, by clicking on edit to a program, it braches to page 28 with program listed as editable field in region one, and mulitple records list in region two from the child record with the same program.
    The problem that I am having is once the program in region one got modified using ApplyMRU, the program in child record did not get updated with the new value and therefore those record become orphan records. I need a way to update all current child records with the new program value.
    Thanks in advance for anyone who can hlep out on this problem.
    Julie
    Edited by: JulieHP on May 24, 2012 4:57 PM

    One Idea is
    If possible create a after update database trigger on the parent table to update the relevant child record.
    Next one
    Create a PL/SQL process on the parent page with process sequence next to ApplyMRU, so when the ApplyMRU is seccessfull it goes not to your process where you can have your update statement

  • How to find child records given a parent key

    I have a master table which is parent for several child tables. I want to display a button to delete a record in master table. I would prefer show this button conditionally so when a master record has child records, I don't show delete button and no error is raised.
    Of course I could scan every child table to find out child records, but I think must exist a generic method
    How can I find out if a given parent key has child records?
    Thanks in advance
    Oscar
    P.S: I'm using 10gR2
    Edited by: user10712087 on 13/01/2009 02:31 PM

    Oscar
    There's no magic/generic way to check that a master row has no associated detail rows. As Pavan says, you have to decide which detail tables to check, and check them using SQL as usual. (Actually, there is a quick way - you delete the row and if there are any child rows with foreign keys that don't cascade, the delete will fail; but of course you can't use this in case the delete succeeds but the user never wants to press the button).
    One addition to Pavan's answer: DO NOT under any circumstances count all the records in every detail table. All you want to know is, is there at least 1 detail record in at least 1 of the tables. No need to count 100 or 1000 rows...
    You can do this like this in your PL/SQL
    FUNCTION check_children(p_master_id IN INTEGER) RETURN BOOLEAN
    IS
      CURSOR c_child1  IS
      select 1 from child_table_1 where master_id = check_children.p_master_id;
      CURSOR c_child2 IS
      select 1 from child_table_2 where master_id = check_children.p_master_id;
      -- etc for all child tables
    l_rec_present integer := null;
    BEGIN
        OPEN c_child_1;
        FETCH c_child_1 INTO l_rec_present;
        CLOSE c_child_1;
        IF l_rec_present i= 1 THEN
            -- there is a child in child_table_1
            RETURN TRUE;
        END IF;
        OPEN c_child_2;
        FETCH c_child_2 INTO l_rec_present;
        CLOSE c_child_2;
        IF l_rec_present i= 1 THEN
            RETURN TRUE;
        END IF;
    -- etc for each child; finally, if no child found:
       RETURN FALSE;
    END;This makes sure that (1) you stop as soon as you find any child, and (2) you don't get any NO_DATA_FOUND or TOO_MANY_ROWS exceptions raised.
    HTH
    Regards Nigel

  • PL/SQL  on delete cascade..   ( how  to view the child record deleted..?)

    Hai
    i have 70 tables integrated with foreign and child key constraints. i have on delete cascade for all the child tables. if i delete the parent table automatically child table record get deleted.
    Kindly tell me how can i check howmany child record has been deleted ..? how can i monitor this...?
    one thing i can do... i can make count of child table before and after...
    is there anyother way..?
    S

    Peter,
    I subscribe to the general consensus around trigger usage. Allthough I allways diffentiate between triggers that,
    - perform pl/sql with embedded DML (that is: delete, insert, update)
    versus triggers
    - that perform pl/sql with embedded queries only.
    The latter use of triggers is good (in my opinion), and most frequently used to enforce (non declarable) data integrity constraints.
    The former use of triggers is bad. Because it makes things happen automagically.
    Just google "asktom triggers are evil", you'll find statements such as:
    ~quote
    because things happen automagically
    because side effects are bad
    because explicit linear code is more maintainable then "happens as a by product of something in the background"
    magic should be avoided. Experience tells me this.
    ~quote
    And to me a CASCADE DELETE clause on a foreign key definition, is a TRIGGER. Allbeit not one for which you had to write CREATE TRIGGER statements, but one that you can declaratively introduce. And this trigger holds embedded DML, it is of the former case, and is therefor bad.
    You the designer of the application may be aware that you have your FK's as cascade delete. But your successor(s) might not be aware of this when they write maintenance code to delete Orders. They might be expecting the database to throw them an FK violation message when they try to delete an Order that still has Lines attached to it.
    Everybody knows the effect of an INSERT, a DELETE, an UPDATE. But the moment you've introduced triggers with embedded DML in them, the effect of these three well known primitive SQL statements suddenly becomes unknown. With triggers you can create any effect for any of these three primitives, that you want. And more often than not other people maintaining your codebase later on in the future, do not realize these side effects happen, because they didn't check the presence of any triggers, nor investigated the side effects caused by them.
    Btw. for exactly the same reasoning I consider use of DEFAULT-clause on table columns, or even use of (fixed length) CHAR datatype, evil also. Again they are in effect declarative triggers with side effects. Allbeit that their side effects usually are less worse than those caused by handwritten triggers with embedded DML.
    Toon

  • How to identify violeted child record

    Hi,
    I want to delete a record in project_objects table it is giving me this error.
    How to idetify the table which is getting related to this table.
    ORA-02292: integrity constraint (NAIODEV.TEMP_TEY_POB_ID_FK) violated - child record found
    Please suggest me is there any command. to know.
    Thanks
    Sudhir.

    Select Table_Name,constraint_Name, Constraint_Type,r_Constraint_Name
      From User_Constraints A
    Where R_Constraint_Name =(Select Constraint_Name
                                 From User_Constraints B
                                      Where Table_Name='EMP'
                                        And Constraint_Type='P'
      And Constraint_Type='R'
      Select Table_Name,constraint_Name, Constraint_Type,r_Constraint_Name
      From User_Constraints A
    Where Constraint_Name In (Select r_Constraint_Name
                             From User_Constraints B
                                  Where Table_Name='EMP'
                                    And Constraint_Type='R'
                                    Group By r_Constraint_Name
      And Constraint_Type='P'
    table :-  USER_CONS_COLUMNS

  • Child Records getting inserted before Parent

    HI All,
    I have an Entity object (Vendors) that has a defined relationship to payments (12 months) when I create a new vendor record I'm creating the 12 child records that all works fine but when I try to issue a commit the child records get inserted first creating a constraint error. If I turn the constraint off and using the "Jbo.debugoutput=console" I can see the 12 months being inserted followed by the vendor record. The payment records vendor_id is being set to the correct parent but the insert is happing in the wrong order does anybody know how to control the order of the insert. There's a Association set between the Vendor entity and the payment entity. If I move the code to a view object it seems to work fine. But in this case we have multiply view objects on these entity objects and I'm trying to prevent having to write the same code in every view Object.
    Here's the code for the Create on the Vendors EntityImpl
    protected void create(AttributeList attributeList) {
    super.create(attributeList);
    // Set the default values and the Seq number for this new record
    SequenceImpl seqNoImpl = new SequenceImpl("VENDORS_SEQ",getDBTransaction());
    this.setVendorId( seqNoImpl.getSequenceNumber());
    Number zeroAmt = new Number(0);
    RowIterator paymentsIter = this.getVendorPayments();
    // When creating a new Vendor create the 12 months of payment records
    for (int i = 1; i < 13; i++) {
    Row newRow = paymentsIter.createRow();
    newRow.setAttribute("Month",i);
    newRow.setAttribute("Amount",zeroAmt);
    paymentsIter.insertRow(newRow);
    Dose anybody have any ideas....

    Pieter,
    Thanks for the information!!
    Using it I was able to get the process working. There where some interesting side affects. If I just turned on the "Composition Association" then no payment records got inserted into the database even though they where in the entity and view objects. I took the second recommendation of adding code to the PostChanges event and was able to get the parent and children inserted in the correct order.
    Thanks again for the idea and information

  • How to poll child records using Physical delete

    Hi, could anyone please help me how to poll child records using the Physical delete polling strategy?I have one parent table and one child table with foreign key constraint with 'on delete cascade'. I understand that physical delete polling strategy does not poll child records and can be polled by configuring the toplink_mappings.xml. how to confure this file in order to poll the child records.
    sample tables are:
    student(stud_id,name,gender,age), stud_id beeing the primary key and
    stud_marks(stud_id,exam,marks1,marks2,marks3), exam beeing the pk, and stud_id, the foreign key with on delete cascade.
    I have set the property DeleteDetailRows="true" in the wsdl.
    Getting a warning:
    'TopLink found problems in PhyDelChildRecordsPoll. Please ensure that these are corrected before deployment.'
    TopLink Map 'PhyDelChildRecordsPoll' -> One of the packages is incomplete.
    Package PhyDelChildRecordsPoll -> One of the descriptors in this package is incomplete.
    Descriptor Student -> Some mappings are incomplete.
    Mapping studMarksCollection -> Method accessors have not been selected.
    End TopLink Map 'PhyDelChildRecordsPoll'
    Thanks.
    Edited by: Help please on Nov 5, 2009 2:39 PM

    Simple solution is to run the query I have given for all child tables or to try a single query for all child tables withj something like:
    select <parent_key>
    from <parent_table>
    where <parent_key> in
              (select <foreign_key_1> from <child_table_1> union
               select <foreign_key_2> from <child_table_2> union
               ... );More complicate solution could be to change the foreign key constraints to cascade DELETE on parent table to child tables:
    SQL>
    SQL> create table p(x int primary key);
    Table created.
    SQL> create table c1(x1 int);
    Table created.
    SQL> create table c2(x2 int);
    Table created.
    SQL>
    SQL> alter table c1 add constraint fk1 foreign key(x1) references p;
    Table altered.
    SQL> alter table c2 add constraint fk2 foreign key (x2) references p;
    Table altered.
    SQL>
    SQL>
    SQL> insert into p values(1);
    1 row created.
    SQL> insert into c1 values(1);
    1 row created.
    SQL> insert into c2 values(1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> alter table c1 drop constraint fk1;
    Table altered.
    SQL> alter table c2 drop constraint fk2;
    Table altered.
    SQL>
    SQL> alter table c1 add constraint fk1 foreign key(x1) references p on delete cascade;
    Table altered.
    SQL> alter table c2 add constraint fk2 foreign key (x2) references p on delete cascade;
    Table altered.
    SQL>
    SQL> delete p where x=1;
    1 row deleted.
    SQL> commit;
    Commit complete.
    SQL> select * from p;
    no rows selected
    SQL> select * from c1;
    no rows selected
    SQL> select * from c2;
    no rows selected
    SQL>Edited by: P. Forstmann on 27 oct. 2011 14:01

  • How to get latest record on top of the result list

    Hi Gurus,
    How to get latest record on top of the result list when you open the record.
    saved data method in BT120H_CPL of OverView page and result list in ICCMP_INBOX.
    Regards,
    Ravi

    Hi
    Try sort descending by on fileld "changed at ".
    manipulate the sort depends on your requirement
    Regards
    Logu

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How to delete the child record from the database

    how to delete a parent and child record from the database can we do it in the servlet and my database is oracle

    I'm not sure I understand the question but you could certainly use the JDBC API from within your servlet to access and modify a DB. You could also use an EJB layer to access your DB and accomplish the same tasks.

  • How to create Child record at the time of master record creation.

    Hi,
    I have MasterVO and ChildVO. And association between both are 1 to *. I have a requirement like, I need to create row in ChildVO at the time of MasterVO row creation.
    I have used entity based association to create view link. This view link created ChildVO accessor in MasterRowImpl as type RowIterator.
    Actually my idea is to override create method in MasterVORowImpl and call ChildVO ViewObject and call .createRow() method on it. But I don't have access to ViewObject, instead it gave access to RowIterator.
    Could you please provide any pointer to achieve above functionality?
    Many thanks in advance.
    Jdev version - 11.1.1.7.0
    Regards,
    Dileep.

    Hi Tim,
    Now it is creating child record at the time of master row creation. But it is working only through BC tester. But when I drag the child VO instance in the jsff page, only master is get created as editable only, child is displayed as read only without populating any default values like child VO surrogate key and other default attributes. But through BC tester it is working fine.
    Am I missing anything here while implementing in UI?
    Thanks,
    Dileep.

  • How can I get Video Recording! on my Blackberry curve 8320 ???????????? HELP PLEASSEEEEE

    Hi, Im a bet stressed out i just got the blackberry Curve 8320 from Tmobile and realized it has no Video recording however the person that sold it to me says they downloaded a program like a converter or something and they used to have video recording on it.  Can you please tell me how i can get video recording on mine Please. Thank you.

    to use video you need an upgrade. The name is handheld device software OS. I believe you have 4.2. 4.5 is required.
    You have to wait for TMobile to release the 4.5 OS.
    The search box on top-right of this page is your true friend, and the public Knowledge Base too:

  • How to obtain parent record from child record in relationship using API

    Hi,
    I have a record in the main table that is the child in a parent/child relationship to another main table record.  Using the Java API, how would I obtain the parent record in the relationship where I am starting with the child record?  In the API there seems to just be calls for getChildren, but not a getParent type call.
    Appreciate any immediate help that can be provided.
    Thanks,
    Eddie

    Hi Eddie,
    Please follow the below steps to retrieve only parents of a child Record.
    1. Create RetrieveRelationshipsCommand.
    2. Set the parameter RelationshipId.
    3. Set the parameter Anchor Record and Anchor Record Id. In this case the child record for which parents records to be retrieved.
    4. Set the parameter setGetChildren as false . This retrieves only the parent records for the specified child reocrd.
    5. Execute the RetrieveRelationshipsCommand.
    6. Retrieve member records from above step.
    Hope it helps
    Regards,
    Neeharika

Maybe you are looking for

  • Windows 8 action center will not open

    I have two problems one being that my action center won't work and if i try to install anything it will pop up a message saying class not registered. The second problem is my sound. My sound works for almost everything but games and itunes and ive tr

  • Difference between concat and concatenation operator ||

    Hi, Most of us may think there is no difference between CONCAT and || By looking in the doc, I can read This function is equivalent to the concatenation operator (||). The function is useful when there are spaces in the values to be concatenated. The

  • File Deletion from PL/SQL using Java

    I'm able to delete a file on the OS from PL/SQL by calling a java class. But there is a problem if I am trying to delete any file located on any machine othere than the one on which the Database is hosted. Can anyone tell me how delete a file which i

  • Convert date charecateristics/time charecateristics to date

    Hi, In sale order cube, there is a characteristic 0act_gi_dte(actual goods issue date), and time characteristic 0calday. we need to find out <b>the number of days</b> between 0act_gi_dte and 0calday(which is 0act_gi_dte - 0calday). is there a way to

  • Dynamic "Filter" value in APD

    Hi People, I have a question about APD. Is there any way to inform dynamic filter value to APD? Like OLAP variable in infopackage selection? For example, I have an transactional ODS receiving data from an APD and it has a "Filter" due to restrict the