Deleting parent record with child instances

Is there a way i can delete records from the database when i have one of the columns being used in other tables.
Eg: m_id used in tables meter ( Primary key ) and period_meter( foreign key) and site_area_meter (foreign key). I want to delete record whose m_id is so and so...
if not then any other idea to discard that parent , child records
thanks in advance

I was able to solve my problem by using the item tag to the Navigate Tree: Get Parent invoke node and then wiring through the item to the next item tag as needed.
I attached a screen shot.
Kenny
Kenny
Attachments:
get items from tree control.gif ‏4 KB

Similar Messages

  • ADF,how to delete parent record and related child record without manual cod

    Hi All,
    I'm using 11g adf.
    I have one parent table PAR and two child table CHD1 , CHD2 respectively.
    I'm inserting values in three tables , making a form having add , delete and edit buttons.
    Issue when i want to delete a record from PAR table , it gives child table record exists . i have did manual coding to delete the child records with related to the selected parent table PAR.
    Is there any process in ADF to delete the child records with respective selected parent record with out manual coding.
    thanks in advance.

    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcentities.htm#BABHFJFJ
    John

  • How to find child records is exists before to delete parent records.

    Dear Everyone,
    I would like to ask you, is there any simple way to find child records is exists before to delete parent records.
    I have a master table defined primary key and I have referenced that as foreign key in many tables.
    I have used Delete_Record to delete but it isn't display the message 'child record exist' but it cleared the record from the form. So I need to know how to find child records is exists or not before to do delete_record so that I can display message in-case it exists.
    I do know we can able to check in every table matching the column manually, but what if we use 100 of tables then it is not possible to check manually.
    I am sure there must be simple way to find as how the oracle identifies when we execute delete query.
    Please help me on this.
    Thanks in advance.

    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

  • SUN TEAM: Bugs in update and delete a record with long query

    Creator Team,
    In my opinio there is a bug issue with update and delete a record with a complex sql query. I�m using oracleXE and ojdbc14.ar with tomcat
    In just two page I�m receving the following msg (I have 12 pages doing the same thing with less complex queries)
    * Number of conflicts while synchronizing: 1 SyncResolver.DELETE_ROW_CONFLICT row 2 won't delete as values in database have changed: 2006-11-29
    * Cannot commit changes: Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 0 values changed in database
    when i tried to delete or commit the updated changes in the register...
    The interesting is that this code function with jdbc of jsc...
    My query is bellow:
    SELECT ALL PATRIMONIO.TB_BEM.INCODIGOBEM,
    PATRIMONIO.TB_BEM.VATOMBAMENTO,
    PATRIMONIO.TB_BEM.VAMATERIAL,
    PATRIMONIO.TB_BEM.INCODIGOSETOR,
    PATRIMONIO.TB_SETOR.VANOME AS NOMESETOR,
    PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR,
    PATRIMONIO.TB_FORNECEDOR.VANOME AS NOMEFORNECEDOR,
    PATRIMONIO.TB_BEM.DACHEGADA ,
    PATRIMONIO.TB_BEM.DASAIDAPREVISTA,
    PATRIMONIO.TB_BEM.DASAIDAEFETIVA,
    PATRIMONIO.TB_BEM.VAMARCA,
    PATRIMONIO.TB_BEM.VAMODELO,
    PATRIMONIO.TB_BEM.VADESBAIXABEM,
    PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO,
    PATRIMONIO.TB_TIPOAQUISICAO.VANOME AS NOMETIPOAQUISICAO
    FROM PATRIMONIO.TB_BEM , PATRIMONIO.TB_TIPOAQUISICAO, PATRIMONIO.TB_SETOR, PATRIMONIO.TB_FORNECEDOR
    WHERE PATRIMONIO.TB_BEM.INCODIGOTIPOAQUISICAO = PATRIMONIO.TB_TIPOAQUISICAO.INCODIGOTIPOAQUISICAO
    AND PATRIMONIO.TB_BEM.INCODIGOSETOR = PATRIMONIO.TB_SETOR.INCODIGOSETOR
    AND PATRIMONIO.TB_BEM.INCODIGOFORNECEDOR = PATRIMONIO.TB_FORNECEDOR.INCODIGOFORNECEDOR
    AND PATRIMONIO.TB_BEM.INCODIGOBEM LIKE ?
    AND PATRIMONIO.TB_BEM.VATOMBAMENTO LIKE ?
    AND PATRIMONIO.TB_BEM.VAMATERIAL LIKE ?
    AND PATRIMONIO.TB_SETOR.VANOME LIKE ?
    AND PATRIMONIO.TB_FORNECEDOR.VANOME LIKE ?
    ORDER BY PATRIMONIO.TB_BEM.VATOMBAMENTO ASC
    Why this problem is happing? Did you had some solution for that? Is the problem because the query is too long?!
    please help me!
    Gustavo Callou

    Hello people,
    I�m doing this to try to solution that bug:
    This code is working fine... but I do not understand why I�m receiving the nullpointer exception!??!!?
    // create a new rowset
    CachedRowSetXImpl pkRowSet = new CachedRowSetXImpl();
    try {
    RowKey rk = tableRowGroup1.getRowKey();
    if (rk != null) {
    // set the rowset to use the Patrimonio database
    pkRowSet.setDataSourceName("java:comp/env/jdbc/Patrimonio");
    String query = "DELETE FROM TB_BEM WHERE INCODIGOBEM = "+tb_bemDataProvider.getValue("INCODIGOBEM", rk).toString();
    pkRowSet.setCommand(query);
    pkRowSet.setTableName("TB_BEM");
    // execute the rowset -- which will contain a single row and single column
    pkRowSet.execute();
    pkRowSet.next();
    info("Apagado");
    } catch (Exception ex) {
    log("ErrorDescription", ex);
    error(getApplicationBean1().trateException(ex.getMessage()));
    } finally {
    pkRowSet.close();
    Please someone help me!!!
    Gustavo Callou

  • Delete multiple records with MDM WebService

    Hi everyone!
    I'm using an MDM Web Service with delete functionality. It identifies records to be deleted either by internal ID or by defined field value. The point is that i need this web service to delete all records with one specific value in specific field (lets say all the records with value "hidden" in field "VISIBILITY").
    But when I try to map value "hidden" of the field "VISIBILITY" to the web service input in BPM it says in tracing that there are multiple fields with that value in the table (certainly there are) and that it can't process them. Cause it doesn't support multiple processing. Is there any way to do that?
    Thanks in advance,
    Peter

    Hi Peter,
    I guess you can do that if you first retrieve the internalIDs of the to be deleted records:
    Do a search for the records with the field value.
    Then you will receive the internalIds of them.
    Then you can put these internalIds to the delete records webservice. Each in a new element of the record identification.
    I hope this helps!
    Best regards,
    Stefan Brauneis

  • 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

  • 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

  • Can't Delete Parent Record - On Delete Cascade is set

    Greetings all,
    I have a parent and child table and when I attempt to delete the parent record, I get the following error:
    ORA-02292: integrity constraint (WFSTEADMAN.INCIDENT_NOTES_TBL_FK) violated - child record found
         Error      Unable to process row of table MYTEST_INCIDENTS.
    I have the the FK set to ON DELETE CASCADE so I am not sure what the issue might be.
    Below are the structures of my parent and child tables:
    I am using apex.oracle.com so the version is: Application Express 4.0.2.00.06
    Any assistance would be appreciated.
    Wally
    PARENT TABLE:
    =============================================================
    CREATE TABLE "MYTEST_INCIDENTS"
    (     "INCIDENTID" NUMBER NOT NULL ENABLE,
         "INCIDENTCREATED" DATE NOT NULL ENABLE,
         "INCIDENT_OWNER" VARCHAR2(200) NOT NULL ENABLE,
         "DTGSTART" DATE NOT NULL ENABLE,
         "DTGEND" DATE,
         "INCIDENT_SERVICES" VARCHAR2(4000),
         "INCIDENT_CUSTOMERS" VARCHAR2(4000),
         "INCIDENT_DESCRIPTION" VARCHAR2(4000),
         "INCIDENT_TIMELINE" VARCHAR2(4000),
         "INCIDENT_TRACKING" VARCHAR2(500),
         "INCIDENT_RESTORE" VARCHAR2(4000),
         "INCIDENT_FOLLOWUP" VARCHAR2(4000),
         "INCIDENT_LEVEL" NUMBER,
         "INCIDENT_TITLE" VARCHAR2(500),
         "EMAIL_NOTIFY" VARCHAR2(4000),
         "TEXT_NOTIFY" VARCHAR2(4000),
         "LEVEL_TYPE" VARCHAR2(25),
         CONSTRAINT "MYTEST_INCIDENTS_PK" PRIMARY KEY ("INCIDENTID") ENABLE
    CREATE OR REPLACE TRIGGER "BI_MYTEST_INCIDENTS"
    before insert on "MYTEST_INCIDENTS"
    for each row
    begin
    if :NEW."INCIDENTID" is null then
    select "MYTEST_INCIDENTS_SEQ".nextval into :NEW."INCIDENTID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_MYTEST_INCIDENTS" ENABLE;
    CHILD TABLE
    =============================================================
    CREATE TABLE "MYTEST_INC_NOTES"
    (     "NOTEID" NUMBER NOT NULL ENABLE,
         "INCIDENT_ID" NUMBER NOT NULL ENABLE,
         "NOTE_DTG" DATE,
         "NOTE_OWNER" VARCHAR2(200),
         "NOTE_COMMENTS" VARCHAR2(4000),
         CONSTRAINT "MYTEST_INC_NOTES_PK" PRIMARY KEY ("NOTEID") ENABLE
    ) ;ALTER TABLE "MYTEST_INC_NOTES" ADD CONSTRAINT "MYTEST_INC_NOTES_CON" FOREIGN KEY ("INCIDENT_ID")
         REFERENCES "MYTEST_INCIDENTS" ("INCIDENTID") ON DELETE CASCADE ENABLE;
    CREATE OR REPLACE TRIGGER "BI_MYTEST_INC_NOTES"
    before insert on "MYTEST_INC_NOTES"
    for each row
    begin
    if :NEW."NOTEID" is null then
    select "MYTEST_INC_NOTES_SEQ".nextval into :NEW."NOTEID" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_MYTEST_INC_NOTES" ENABLE;
    CREATE OR REPLACE TRIGGER "MYTEST_INC_NOTES_T1"
    BEFORE
    insert or update on "MYTEST_INC_NOTES" REFERENCING NEW AS NEW OLD AS OLD
    for each row
    begin
    :NEW.NOTE_DTG := SYSDATE;
    end;
    ALTER TRIGGER "MYTEST_INC_NOTES_T1" ENABLE;

    Yeah there was a rampant child table still left out there. Noticed the issue and deleted the child and all is well now. :). Should have looked for a couple more minutes before posting.
    Thanks
    Wally

  • How to delete data-records with BI-planning in BEx?

    Hi folks, masters and gurus,
    we just upgraded some of our functions from BPS to BI-Planning.
    Only one thing I could not resolve up to now:
    In BPS (web based) it was easily possible to delete data-records by choosing a radio-button beside the data-entry-field and click the "delete"-button (a red "-") on the top.
    When I tried to find a delete-function in RSPLAN now I only found one that deletes the data, but not the record itself.
    Does anyone know how to build a function that I can use to delete data-records?
    Thx in advance for your help,
    Thomas

    Oh yes ... it´s not necessary as it is easily possible to supress lines with only 0 in it with
    query-properties / rows/coloumns / supressing Zero / activ ...
    Edited by: Thomas Kejik on Jan 19, 2009 9:46 AM

  • How to delete the records with routine Z_AFRP4_DELETE as note [418584|

    Hello Gurus,
    I don't want to transfer data into HR and want to delete the records in table AFRP4 to business complete the Maintenance Orders
    Component version- EHP7 for SAP ERP 6.0
    Component-EA-APPL
    Release-617
    how can I delete these records
    Thanks fro Help
    AM

    Hello All,
    I found the solution, I copied the code in correction instruction number 0000282352 and create the report as programme  Z_AFRP4_DELETEand the executed
    *$*$----------------------------------------------------------------$*$*
    *$ Correction Inst.         0120061532 0000282352                     $*
    *$--------------------------------------------------------------------$*
    *$ Valid for       :                                                  $*
    *$ Software Component   SAP_APPL   SAP Application                    $*
    *$  Release 40B          All Support Package Levels                   $*
    *$  Release 45B          All Support Package Levels                   $*
    *$  Release 46B          All Support Package Levels                   $*
    *$  Release 46C          All Support Package Levels                   $*
    *$  Release 470          All Support Package Levels                   $*
    *$  Release 500          All Support Package Levels                   $*
    *$  Release 600          All Support Package Levels                   $*
    *$  Release 602          All Support Package Levels                   $*
    *$  Release 603          All Support Package Levels                   $*
    *$  Release 604          All Support Package Levels                   $*
    *$  Release 605          All Support Package Levels                   $*
    *$  Release 606          All Support Package Levels                   $*
    *$--------------------------------------------------------------------$*
    *$ Changes/Objects Not Contained in Standard SAP System               $*
    *$*$----------------------------------------------------------------$*$*
    *& Object          REPS Z_AFRP4_DELETE
    *& Object Header   PROG Z_AFRP4_DELETE
    *& REPORT Z_AFRP4_DELETE
    REPORT  Z_AFRP4_DELETE .
    * This report deletes confirmation records from table AFRP4 that are
    * not longer needed. Run it without update flag first !!
       tables: afrp4.
       data: lt_afrp4 like afrp4 occurs 0,
             ls_afrp4 like afrp4.
       selection-screen begin of block order with frame.
       select-options: zorders for afrp4-aufnr.   "order number
       selection-screen end   of block order.
       parameters: update as checkbox.
       select * from afrp4 into table lt_afrp4
                    where aufnr in zorders.
       if lt_afrp4[] is initial.
         format color col_normal.
         write: 'No HR confirmation background records read.'.
         exit.
       endif.
       format color col_heading.
       write: /5 'Order', 25 'Confirmation', 45 'Counter'.
       skip.  uline.  skip.
    * show corrections
       loop at lt_afrp4 into ls_afrp4.
         format color col_normal.
         write: /5 ls_afrp4-aufnr, 25 ls_afrp4-rueck, 45 ls_afrp4-rmzhl.
       endloop.
    * update on data base table
       if not update is initial.
         skip.  uline.  skip.
         delete afrp4 from table lt_afrp4.
         if sy-subrc is initial.
           format color col_positive.
           write: 'HR-records deleted successfull'.
         else.
           format color col_negative.
           write: 'Error when trying to update data base table AFRP4.'.
         endif.
       endif.

  • I want to delete parent record so that its child is automatically deleted

    Hi Gurus , i was trying to delete the child record as soon as parent is deleted.
    How do we do that?
    I can delete child 1st but it seems that there are lots of child data in different table.
    I have heard 'on delete cascade ' does that.
    Can you please help me out how to use that in delete statement???

    You should change your relationship to on delete = cascade. For example:
    alter table tb2 drop constraint fk;
    alter table tb2 add constraint fk foreign key (n) references tb1(n) on delete cascade;
    When you delete father table, will be deleted all children that have relationship like delete cascade.

  • SM30 - Deleting a record with Foriegn Key Constraints

    I have a two custom tables ZCCED_STATUS and ZCCED_COSTITEM. 
    ZCCED_COSTITEM has a status column with a foriegn key to a (PK) status record in ZCCED_STATUS.
    I have generated table maintenance objects for the table ZCCED_STATUS.
    When I go to SM30 and maintain the table ZCCED_STATUS I can select a status record and delete it. (still ZCCED_COSTITEM records using that status)
    Is there any way that SM30 can warn or stop a user from deleting a ZCCED_STATUS record when there are child records in the ZCCED_COSTITEM table?
    Regards,

    Create a maintenance view , link both tables and generate a table maintenance for the maintenance view . it will work.

  • Recording with multiple instances of audition 3.01

    Hello again.
    Recently I upgraded a few machines from windows xp and audition 1.5  to Vista and  audition 3.01
    The most glaring difference now seems to be when our users have multiple audition windows open in 1.5  all recording from the same audio source.
    The board ops  might have 3 instances running so they can capture "highlights"  and while they are editing a particular piece of audio  the other instances are still recording.
    I have the setting unchecked that releases the asio driver when the window is not in focus.
    But when you start the record button on a second instance both recordings stop
    Is there a way to set up version 3.01 to do this or will I have to go back to using v1.5?
    Thanks

    ATM  I am using USB Creative Labs sound cards. These machines are used for simple "Highlight capture" for sporting events. No actual asio drivers just the standard  WDM drivers that came with the sound device.  (Creative Sound Blaster X-Fi Surround 5.1 Pro USB Sound Card | Creative Labs Online Store)
    Eventually I will be upgrading these to http://www.bswusa.com/USB-Interfaces-Henry-Engineering-USB-Matchbox-II-P2601.aspx for direct interface into our mixing boards.

  • Re: Display Parent Accounts with Child Accounts

    I am creating an Accounts Application and whenever the User query for particular Account Transactions, that Account's Parent Accounts must also return.
    Here is the DML.
    CREATE TABLE MYACC
    (ACC_NO NUMBER(3), PARENTID NUMBER(3),
    ACC_NAME VARCHAR2(20));
    INSERT INTO MYACC VALUES(111,NULL,'ASSETS');
    INSERT INTO MYACC VALUES(112,111,'CURRENT ASSETS');
    INSERT INTO MYACC VALUES(113,112,'RECEIVABLES');
    INSERT INTO MYACC VALUES(114,111,'FIXED ASSETS');
    INSERT INTO MYACC VALUES(115,113,'MACHINERY');
    CREATE TABLE MYTRANS
    (TRANS_DATE DATE, ACC_NO NUMBER(3),
    BRANCH NUMBER(1),TRANS_AMT NUMBER(10));
    INSERT INTO MYTRANS VALUES('01-JUL-2006',113,1,10000);
    INSERT INTO MYTRANS VALUES('01-AUG-2006',113,1,11000);
    INSERT INTO MYTRANS VALUES('01-SEP-2006',113,2,12000);
    INSERT INTO MYTRANS VALUES('01-OCT-2006',113,3,13000);
    INSERT INTO MYTRANS VALUES('01-NOV-2006',115,3,12100);
    INSERT INTO MYTRANS VALUES('01-DEC-2006',115,3,13200);
    INSERT INTO MYTRANS VALUES('01-JAN-2007',115,3,15400);
    INSERT INTO MYTRANS VALUES('01-FEB-2007',115,3,13000);
    If I query for Branch No. 3,
    and Trans_Date between 1st July 2006 to 31st Dec 2006
    following should be displayed.
    Branch     Account          Trans_Date     Trans_Amt
    3     Assets     
    3     Current Assets     
    3     Receivables     01-OCT-2006     13100     
    3     Fixed Assets
    3     Machinery     01-NOV-2006     12100     
    3     Machinery     01-DEC-2006     13200
    If I query for Branch No. 3 and Account No. 115
    following should be displayed.
    Branch     Account          Trans_Date Trans_Amt
    3     Assets     
    3     Fixed Assets
    3     Machinery     01-NOV-2006     12100     
    3     Machinery     01-DEC-2006     13200
    Any idea please ?
    Best Regards,
    Luqman

    Dinamic select for find the children:
              select *
              from myacc
              start with acc_no = &Code
              connect by prior myacc.acc_no = myacc.parentid

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

Maybe you are looking for