How to delete parent and child records together ?

Hi,
I'm using Jdeveloper 11.1.2.2
I want to delete a row from a table but it is showing: Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (TABLE1_TL_FK1) violated - child record found.So how can I delete a Child row and table row in one method ?
I cannot access the child's VO because it is not added to the AM.
Thanks,
Nigel.

John, as usually, is right with the pointer to the documentation he pasted. Just to make sure you read it carefully, let me hoghlight an important point here:
"If the option is selected, then the composed entities do not perform the DELETE statement *on the assumption that the database ON DELETE CASCADE constraint will handle the deletion of the corresponding rows*."
So make sure the database is setup for cascade delete as otherwise you still will not succeed
Frank

Similar Messages

  • How to delete parent and child records?

    Hi friends,
    I have a Master table and a child table.
    The Child table got reference key with the master table without on delete cascade.
    Now, I want to delete the Master records and also it's corresponding child records.
    How to do?
    Thanks in adv,
    regards,
    Vijay

    Delete the records from the child, then delete the records from the parent in two separate delete statements. I'd prefer that you create a stored procedure that does both steps.
    Justin

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

  • How to link parent and child relation in Metapedia

    How to link parent and child relation in Metapedia

    Vamsi,
    Did you every determine how to do what you were asking about? Where you thinking of how to link a parent term to a child term (i.e. like a related term) or was this about linking a term to a different metadata object (e.g. table or report) ?

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

  • How to kill parent and child thread in sequnece

    Hello freinds,
    I have one class FirstClass which creates one thread Pserver and Pserver creates three threads then how to kill parent Pserver and child threads.........

    define a method that requests that the parent thread terminate itself, and within the code called when the thread is shutting itself down, have it do something similar to its child threads: call methods that request they shutdown themselves.
    One common way to do this is to interrupt the thread.

  • How to differentiate parent and child node in af:treeTable ?

    Greetings,
    I have a requirement, I display master child view objects using <af:treeTable> component, When user expands a parent row, I have to make parent row is in read only and expanded(child) row in editable. To accomplish this I have to identify the 'node' whether it belongs to parent or child view object. In this example Tree table binds with EmpVO, There is a view link beteween EmpVO and DepartmentVO.
    <af:treeTable value="#{bindings.EmpVO.treeModel}"
    var="node"
    rowSelection="single" id="tEqSum"
    summary="Employee Summary"
    <af:column sortProperty="#{bindings.EmpVO.hints.LocCity.name}"
    filterable="true" sortable="true" width="90"
    headerText="#{bindings.EmpVO.hints.LocCity.label}"
    id="c3">
    <af:outputText value="#{node.LocCity}" id="ot21"/>
    expandAllEnabled="false">
    </af:treeTable>
    Thanks in Advance,

    Hi,
    You can find out the node depth by using
    #{bindings.<your_tree_binding>.treeModel.depth}Based on the depth, you can decide whether its a parent node or child node (for a 1 level tree- say dept and emp, the depth for parent would be 0 and for the child it would be 1).
    -Arun

  • How to give filter condition in expdp to filter parent and child records?

    Hi,
    I have a requirement of export schema. Assume there is a account details table and account transactions table under schema.They have parent child relation exist. if i filter accounts from account details the corresponding transactions in account transactions table should be filterd.How to achieve this?
    Regards,
    Venkat Vadlamudi
    Mobile:9850499800

    Try with USER_DEPENDIENCIES
    select * from user_dependencies

  • How to persist parent  and child tree node data through JSF and Hibernate

    Dear dudes,
    I'm a novice to JSF and Hibernate
    Actually i want to create a tree structure where for each child node, i should have the parent node reference in my form and then when i save, i need to save the corresponding child node data in the database.
    node-1
      node 1-1
         node 1-11a
      node 1-2
    node-2
       node 2-1
       node2-2Whenever i click node 1-1 the corresponding parent node ( node-1) reference should appear in my form and when i save this data this data should be saved under parent node and the tree should be re-rendered.
    How this can be accomplished and if there are any URL's please refer.

    Everybody need not face the same problem you faced. And moreover, everyone out here have their own issues to solve. If people are helping out here, its cause of their passion. Please try to be polite.
    First of all, what is that you have tried on the issue? Could you please share your work so that we can try to fill the gaps?

  • How to filter parent and child tables data in impdp?

    Hi Friends,
    i hope everyone doing good..
    I have two tables in my schema like below.
    STUDENT_DTLS:-
    SID Sname CID
    1     venkat     001
    2     uppy     002
    3     deepu     003
    4     trinath     003
    5     naveen     004
    6     ramesh     005
    COURSE_DTLS:-
    CID CNAME Fee
    001     Oracle     2000
    002     java     6000
    003     sieble     4000
    004     informatica     3000
    005     obiee 4000
    if I load only few Student details say sid=1,2,3 into another environment using impdp,corresponding to those students course details from COURSE_DTLS table only need to be loaded.Not all course details.
    Iam Expecting Result in new schema as below:-
    SID Sname CID
    1     venkat     001
    2     uppy     002
    3     deepu     003
    CID CNAME Fee
    001     Oracle     2000
    002     java     6000
    003     sieble     4000
    But when i am using the below import scrit,The COURSE_DTLS is loading first and its query option(select cid from STUDENT_DTLS) is returning no rows.Because at that time no data is insertred into STUDENT_DTLS yet.
    secondly it is importing data into STUDENT_DTLS with query option where sid=in (1,2,3) which is loaded propelry.
    Thirdly it is trying to enable primary key and Foreign key constraints which is also failing because of no data in COURSE_DTLS table.
    i have changed the order of tables in TABLES clause like tables=COURSE_DTLS ,STUDENT_DTLS.But still COURSE_DTLS table is loading first.
    impdp pa_data_sub/******* NETWORK_LINK=qdssih30 tables=STUDENT_DTLS,COURSE_DTLS query='STUDENT_DTLS:"where SID IN(1,2,3)"','COURSE_DTLS:"where cid in(select cid from STUDENT_DTLS)"', CONTENT=all table_exists_action=replace directory=DATA_PUMP_DIR logfile=exp_join.log
    output:
    Total estimation using BLOCKS method: 128 KB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    . . imported "PA_DATA_SUB"."COURSE_DTLS" 0 rows
    . . imported "PA_DATA_SUB"."STUDENT_DTLS" 3 rows
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    ORA-39083: Object type REF_CONSTRAINT failed to create with error:
    ORA-02298: cannot validate (PA_DATA_SUB.SYS_C0040905) - parent keys not found
    Failing sql is:
    ALTER TABLE "PA_DATA_SUB"."STUDENT_DTLS" ADD FOREIGN KEY ("CID") REFERENCES "PA_DATA_SUB"."COURSE_DTLS" ("CID") ENABLE
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Job "PA_DATA_SUB"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at 17:28:13
    Please suggest me how to achieve this task in a single import command?
    Is there any option in impdp to prioritize the table to be loaded first?
    Thanks,
    Venkat Vadlamudi

    You can't be guaranteed which order the data will be loaded in, so using a query that examines a table that is being imported is not going to always work the way you want it. The failing constraints makes sense because there is no data.
    So, in your case, course_dtls gets imported first and the table student-dtls exists, but it not populated yet, so the select cid from student_dtls comes back with 0 rows. The second query works fine.
    You might be able to change the query to be:
    'COURSE_DTLS:"where cid in(select cid from STUDENT_DTLS@qdssih30 where SID IN(1,2,3)"'
    This way, you query the source table pointed to by the network link and you use the same subquery from the first table.
    This should work for you... I think anyway.
    Dean

  • How to create parent and chile process in java

    i'm beginning in java, and i want to ask something, please help me...
    1. i want to ask how to create parent and child process in java???
    example :
    if have one window and explore menu, when i click the explore menu.
    new window come out.
    how if i close the parent window the child window will close too...
    2. what is the method from runtime class to get available memory and Active Threads count

    ONE way to do what you wanted is this.
    class Parent{
    Child c = new Child
    allChildren.add(c);
    //if close
    iterate through list
    (Child)allChildren.get(index).close();
    ArrayList allChildren;
    class Child{
    public void close(){ }
    i dont know if you can get the thread count. but you can
    get the current thread by using System.
    Memory: Runtime.freeMemory() .maxMemory() .totalMemory()
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    Careful though you have to do a calculation to get the
    actual memory because those 3 methods refer to freeMemory
    of the CURRENT heap not the total memory.
    i think its: total - (max - free)

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

  • Delivery document how to print the BOM Parent and Child items

    Hi,
    I have a production BOM. In Delivery document how to print the Parent and Child items Item Code and Qty.At the time
    of add a delivery document Inventory stock redused only in Parent Item not child item because child item stock already reduced in issue for production.

    If you need to print both the BOM Parent and Child items, you have to create your own report. BOM is only for production if it is not Sales type.
    Thanks,
    Gordon

  • How to differentiate between Parent and Child in IBASE?

    Hi. I am working on enhancing a BAPI :BAPI_GOODSMVT_CREATE by calling the following function module IBPP_CREATE_IBASE at its exit.
    The BAPI is being called from an SAP ME system and will be passing MATNR and Serial Number of Parent and Child materials to create the IBASE in ECC system. I am confused as to how to differentiate between whether a object is Parent or a Child when the BAPI: BAPI_GOODSMVT_CREATE is called.

    if you have NULL valued fields. If
    you do a compare and one or both are NULL, then the result is always NULL,
    never true or false. Even comparing two fields which are both NULL will
    give NULL as result, not true! Or if you have something like "select
    sum(field) from ..." and one or more are NULL, then the result will be
    NULL. Use always "if field is NULL ..." for NULL checking and for safety
    maybe something like "select sum( IsNull(field,0) ) from ...". Check the
    function ISNULL() in the manual.

  • How to use Opendoc to link parent and child

    I have parent and child reports, I want to link them. When I click parent id then it should display child report.
    How to use Opendoc for this?
    Thanks,
    Charita

    You can use openDoc selection variable method for link the reports.
    Refer this link
    http://book.soundonair.ru/sams/ch31lev1sec2.html#PLID2

Maybe you are looking for

  • The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST

    Hi, When trying with Postman sending a REST call to Azure Storage Queues I get: The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST. The code I have for creating the

  • Optical Disc will not eject

    I recently installed Leopard on my Macbook and forgot to eject the optical disc. I just tried to eject it and it will not eject. I used every method to eject a DVD that I could find. The drive makes the usual eject sounds but nothing happens. I viewe

  • Import image into pdf

    I'm creating a form-fill PDF for our client. They have digital scans of their signatures and want a field in the form where the end user can click, browse to their signature file and place it. I'm assuming they would need to size it as well. Anything

  • Hiding & Unhiding Sprite with Lingo?!

    Whats up guys; here's the situation. I have some videos that play; the problem is that it's unclear when each video is done playing. So the client wants me to flash the next button once the video in that section is done playing. So here's what I have

  • Find date diffrence

    I need it urgent plz help me join date : 01-jan-2010 let today : 01-feb-2011 Ans is: *1 year 1 month* like this