Delete the parent record

hi all,
based on the thread i got the list of child tables.
Re: to find the tables which is having link with particular table.
no i have doubt in deletion process.
My ultimate aim is to delete the bl_det records.
let me explain with ex.
i have table
BL_DET --parent table with comp and ref as primary key
which is having child rec.
BL_CON --child of BL_DET(comp,ref) primary key comp,ref and serial
BL_CON_PCK --is child of BL_CON(comp,ref,serial) primary key comp,ref,serial,pck_gp_srl,gp_srl.
DELETE BL_CON_PCK
WHERE BCK_COMP = :GLOBAL.comp
AND BCK_REF = :parameter;
DELETE FROM BL_CON
WHERE BCR_COMP = :GLOBAL.comp
AND BCR_REF = :paramter
DELETE FROM BL_DET
WHERE BL_COMP = :GLOBAL.comp
AND BL_REF - :parameterwill delete the correct set of records.(my doubt area is delete statement written for the table BL_CON_PCK).
Please tell me if i am wrong.
Thanks..

(my doubt area is delete statement written for the table BL_CON_PCK).Cannot understand your doubt. What is your doubt, are you getting any error while executing your code?
To delete a record from parent table all child references must be deleted. So your delete statement appears right
-- How delete should progress
BL_CON_PCK >> BL_CON >> BL_DET
{code}
If you have created foreign constraint using ON DELETE CASCADE or ON DELETE SET NULL then you can straight away delete from parent table and all child references are deleted/set as null respectively. Read Oracle Documentation to see details
Short demonstration
{code:sql}
SQL> CREATE TABLE A(a1 NUMBER PRIMARY KEY , a2 NUMBER);
Table created
SQL>  CREATE TABLE B(b1 NUMBER PRIMARY KEY , a1 NUMBER);
Table created
SQL>  CREATE TABLE C(c1 NUMBER, b1 NUMBER);
Table created
SQL>  ALTER TABLE B ADD CONSTRAINT FK_B FOREIGN KEY (a1) REFERENCES A ON DELETE CASCADE;
Table altered
SQL>  ALTER TABLE C ADD CONSTRAINT FK_C FOREIGN KEY (b1) REFERENCES B ON DELETE CASCADE;
Table altered
SQL>  INSERT INTO A VALUES (1,2);
1 row inserted
SQL>  INSERT INTO B VALUES (3,1);
1 row inserted
SQL>  INSERT INTO C VALUES (4,3);
1 row inserted
SQL>  SELECT * FROM A;
        A1         A2
         1          2
SQL>  SELECT * FROM B;
        B1         A1
         3          1
SQL>  SELECT * FROM C;
        C1         B1
         4          3
SQL>  DELETE FROM A WHERE A1=1;
1 row deleted
SQL>  SELECT * FROM A;
        A1         A2
SQL>  SELECT * FROM B;
        B1         A1
SQL>  SELECT * FROM C;
        C1         B1
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • 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

  • Help, I accidentally deleted the parent tab set.

    I accidentally deleted the parent tab set from my application, and cannot find anyway to create a new one. Has anyone had this problem?
    Oracle - 9.04R2
    ApEx - 2.2.0
    Browser - Firefox
    Thanks,
    Michelle

    Hi Scott,
    unfortunately I made a stupid thing, being too smart and updating the FLOWS_020200.wwv_SOMETHING_tabs record, modifying parent tab of the problematic tab to main. Doing that caused the complete application to disappear from the Application builder. I guess some checksums in APEX internal objects were modified and that is the result.
    Fortunately I had a recent export of an application, so I didn't loose too much. That also means that I can not help myself with "as of" export.
    Could you please just tell if recreating parent tabs is possible by "clicking through apex screens" or should there be some hacking used.
    Zober

  • How to Delete the condition record in CRM

    HI,
    Can you please help me how to delete the condition record from condition table in CRM.
    Please explain the usage of FM CRMXIF_CONDITION_SEL_DELETE with examples.
    I have also read the documention of the function module. How to use this FM for custom defined condition table.
    (this is the code given in Documentation)
    DATA-OBJECT_REPRESENTATION         = 'E'
    DATA-SEL_OPT-CT_APPLICATION              = 'CRM'
    DATA-SEL_OPT-OBJECT_TASK                    = 'D'
    DATA-SEL_OPT-RANGE-FIELDNAME        = 'PRODUCT_ID'
    DATA-SEL_OPT-RANGE-R_SIGN                  = 'I'    (Including)
    DATA-SEL_OPT-RANGE-R_OPTION           = 'EQ'
    DATA-SEL_OPT-RANGE-R_VALUE_LOW  = 'PROD_1'
    Thanks
    Shankar

    Hi Shankar,
    I am using the same CRMXIF_CONDITION_SEL_DELETE function module to delete condition record present in CRM.
    But it is giving me below error in the return table of the FM after i run the program. Can you please correct me if I am doing any thing wrong?
    Error in  lt_return: SMW3     CND_MAST_SEL_DEL_EXT_VALIDATE     CND_M_SD
    code:
    ls_range-fieldname = 'PRODUCT_ID''.
    ls_range-R_SIGN = 'I'.
    ls_range-R_OPTION = 'EQ'.
    ls_range-R_VALUE_LOW = '123456'.
    APPEND ls_range TO lt_range.
    MOVE lt_range TO ls_entry-SEL_OPT-range.
    ls_data-SEL_OPT-object_task = 'D'.
    ls_data-SEL_OPT-ct_application = 'CRM'.
    ls_data-object_representation = 'E'.
    CALL FUNCTION 'CRMXIF_CONDITION_SEL_DELETE'
      EXPORTING
        DATA          = ls_date
    IMPORTING
       RETURN        = lt_return
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      IMPORTING
        return = lt_ret.
    Edited by: Saravanaprasad Nadar on Jul 7, 2010 1:27 AM

  • How to delete the material records related to storage type

    Dear SAP guru's,
    I got a situation that if the material "XXXXXX" exists in two different storage type (let say 001 & 002 ) and the material needs to be removed out of one (Let say 002) to avoid the picking and putaway in future.
    Inorder to accomplish an above requirement we tried the below cases
    Case 1: By flagged the material "XXXXXX" under storage type 002 in MM06 transaction.But it didn't restrict the system on allocating and removing the stock from /to to the storage type 002.
    Case 2:After we flagged the material for deletion under storage type 002 ,we used to MM71 transaction to archive & delete the material record that assocaited with the storage type 002 completely.
    I am kind of queiries to know if there is any other method or procedure available to delete the storage type associated material records in SAP.
    Please guide me with the other options.Thanks.
    Regards,
    John.

    Hi John,
    Its very simple, remove the Storage type indicators from the material master - Warehouse View 1 at Stock placement & Stock removal section, with this it won't pickup or place the materials in the concerned storage type.
    If you have extended this materials to more than 1 storage type, you need to do the same for all the storage types.
    Reward if it is helpful.

  • How to delete the duplicated records, not just surpress the records?

    I am new to CR. Right now I am doing a project which needs CR get query from Oracle. I got the query from Oracle. There are records with duplicated fields. For example (the following only show part of fields):
    ID    body_code  
    1            10            
    2             10            
    3             15            
    4              15           
    5              15           
    6              16           
    I need to only select records (not surpress, because I will do some caluculate later) like following:
    ID         body_code        
    1             10         
    2              15
    3               16   
    I tried to creat selection fomula in fomula workshop, shown as follows:
    onlastrecord;
    <>next
    but CR said next can be evaluated. I think it must have something to do with the print-time. So what show I do to delete the duplicated records.Thank you very much.

    Ting,
    Try this:
    Insert a group on body_code.  Then create a running total called Distinct Count.  Field to summarize -> ID, Evaluate on change of group Group # 1 Body Code, and Never Reset.
    Then insert a chart in the report header:
    In the advanced layout, select body_code on change of and select Distinct Count running total in the Show values.
    I hope I understood what you're looking to accomplish.
    Z

  • How to delete the duplicate records in a table without promary key

    I have a table that contains around 1 million records and there is no promary key or auto number coulums. I need to delete the duplicate records from this table. what is the simple effective way to do this.

    Please see this link:
    Remove duplicate records ...
    sqldevelop.wordpress.com

  • How to delete the single record from the  ODS

    HI,
       I want to DELETE  the particular record from ODS.. how to delete that..
    plz give me the solution.. it's urgent..
    with regards
    @jay

    Hi Prakash,
        You can delete a particular record from ODS by specifying the key field name in Selective deletion button available in Contents tab in the manage screen of ODS. But it will only delete the record from the active data table and not from the Change log and new data table . You should be very carefull if you are doing in Production system as there is chance of deleting other records accidentally.
    Go to Selective deletion button - > Click on delete selection -> Enter the key field values of the record you want to delete-> Press save button to save as Variant -> Go back and click on selection button -> Chosse the background job type -> Click on start button.
    Regards,
    Prakash

  • DELETE THE MATCHED RECORDS IN DB2 TABLE

    DELETE THE MATCHED RECORDS IN DB2 TABLE
    sql server table sqlserver_emp(c1,c2,c3,4)
    records:1 2 3 4
    DB2 table db2_emp(c1 key,c2,c3,c4)
    records:1 2 5 6 7 8
    Both tables having same structure
    Matched records : 1 2
    1.Delete the matched records in db2 table : 1 2 (without using truncate option for DB2 in Anywhere)
    2.Finally Load all records in sql server(Because duplicate records in db2 already removed so no duplicates occured)
    3.NEED final OUTPUT AS:db2 table: 5 6 7 8 1 2 3 4
    Note:
    1.DB2 truncate doesn't used
    2.STARING AREA: ORACLE
    3.SQLSERVER AND DB2 CLOSED ENVIRONMENT DOESN'T USED AS STAGING AREA.
    HOW MANY INTERFACES AND PROCEDURES SHOULD BE CREATE? WHAT ARE THEY?
    HOW TO REACH MY REQUIREMNT?
    Answer provider is more appricatable.
    Thanks in advance.
    Edited by: krishna on Nov 9, 2011 8:40 PM

    1st option
    See in this scenario you can use two interface and one procedure step.
    1st interface-->poricedure-->2nd interface
    1st interface will bring data to oracle staging-->then procedure will delete matched record from target using keys--->3rd interface will simple insert the the data in oracle staging.
    2nd option
    Insted of deleting the target matched records, you just update target matched record with latest records in your staging oracle.You can use IKM Merge
    Thanks

  • DB Adapter polling : Not deleting the read records

    Hi,
    I have a simple BPEL process to poll a database table to delete records after reading them.I tried testing by inserting a single record into the table.BPEL is simply creating new instance (as it is not deleting the read records).
    I am using fusion middleware version 11.1.1.3.0.
    Also i am not able to view flow trace.I see a row under flow trace but there is no link to open audit trail or flow page.How to enable this.
    thanks,
    ashok

    Hi Naresh,
    Here is the contents of jca file:
    <adapter-config name="readDB" adapter="Database Adapter" wsdlLocation="readDB.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/DB/ArbonneProd" UIConnectionName="ArbonneProd" adapterRef=""/>
    <endpoint-activation portType="readDB_ptt" operation="receive">
    <activation-spec className="oracle.tip.adapter.db.DBActivationSpec">
    <property name="DescriptorName" value="readDB.CustomersToOracle"/>
    <property name="QueryName" value="readDBSelect"/>
    <property name="MappingsMetaDataURL" value="readDB-or-mappings.xml"/>
    <property name="PollingStrategy" value="DeletePollingStrategy"/>
    <property name="PollingInterval" value="10"/>
    <property name="MaxRaiseSize" value="1"/>
    <property name="MaxTransactionSize" value="10"/>
    <property name="NumberOfThreads" value="1"/>
    <property name="ReturnSingleResultSet" value="false"/>
    </activation-spec>
    </endpoint-activation>
    </adapter-config>
    Under trace i see below record:
    Instance Type Usage State
    ReadDB of service:<instanceid> JCA Adapter Service Completed

  • DELETING THE MASTER RECORDS

    Hi gurus,
    i want to upload the new master records into my system regarding the MM. first thing i want to delete the old records in the system and freshly want to load into the system. please give me the soluion how to do it.
    it is a development server..
    thanks in advance..
    ravi

    i want to upload the new master records into my system regarding the MM. first thing i want to delete the old records in the system and freshly want to load into the system. please give me the soluion how to do it.
    >
    > it is a development server..
    When uploading the new master records, just assign the previous numbers used by the old master records and the new upload will overwrite those old records. In this case deleting/overwriting the old records.
    If you dont assign the new upload any numbers, it will append below the exisiting records, that way not deleting the old records.

  • Deleting the duplicate records

    Hi all,
    I have some duplicate records in the PSA . and i want to delete the duplicate records before the data is entered into the data target. Can anybody tell me how to achieve this.
    Actually i need to achieve this  by using the ABAP code.
    Thanx & Regards,
    RaviChandra
    Edited by: Ravichandra.bi on Mar 5, 2012 3:37 PM

    Hi Ravi,
    If its a full load to the PSA and because of it you are getting duplicate records and you want to eliminate them,
    you can do what  Anshul and Durgesh suggested.
    Write the code in the start routine of the transformation to your target
    SORT SOURCE_PACKAGE BY KEY1 KEY2 KEY3. "(The key will be the key of your target)
    DELETE ADJACENT DUPLICATES FROM SOURCE_PACKAGE
          COMPARING KEY1 KEY2 KEY3.
    Hope this helps
    Regards,
    Joe

  • Close Firefox, restart it says firefox can not start - already running, tried deleting the parent.lock it doesn't exist. I try to turn off my computer it says WidgiBho needs to close, I tell it to close but computer never shuts down

    close Firefox, restart it says firefox can not start - already running, tried deleting the parent.lock it doesn't exist. I try to turn off my computer it says WidgiBho needs to close, I tell it to close but computer never shuts down

    Did you try to wait a bit longer before restarting Firefox to give Firefox more time to close down completely?
    See "Hang at exit":
    *http://kb.mozillazine.org/Firefox_hangs
    *https://support.mozilla.com/kb/Firefox+hangs

  • How to delete the matching records from two internal tables

    Hi ,
    I have two internal tables say A and B of the same type. If A has 10 records and B has 4 records , I want to delete the 4 records in B from A .
    loop at B into wa .
    delete A where key = wa - key .
    endloop.
    takes a long time if the table B is huge. how can I improve the performance.
    Thanks.
    Gayathri

    Hi Gayathri,
    You could try field-symbols. It reduces the data transfer from the internal table B to the work area.
    field-symbols <fs_itab_b> like line of B.
    loop at B assigning <fs_itab_b>.
      delete A where key = <fs_itab_b>?-key.
    endloop.
    Regards,
    <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=zwcc%2fwm4ups%3d">anand Mandalika</a>.

  • Select statement from a join file deletes the primary records with MS Expl.

    Hello,
    is reality,
    Select statement from a join file deletes the primary records with MS Explorer 6, Firefox not, this with a normal data provider or with a normal "select..." statement.
    This is very strange, I should have a.a.s.p. a solution or workaround
    Thanks, Franco.
    Message was edited by:
    fbiaggi

    Please see the following excerpt from the online documentation.
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_modes.htm#SUTIL1332
    Enabled Constraints
    During a direct path load, the constraints that remain enabled are as follows:
    NOT NULL
    UNIQUE
    PRIMARY KEY (unique-constraints on not-null columns)
    NOT NULL constraints are checked at column array build time. Any row that violates the NOT NULL constraint is rejected.
    Even though UNIQUE constraints remain enabled during direct path loads, any rows that violate those constraints are loaded anyway (this is different than in conventional path in which such rows would be rejected). When indexes are rebuilt at the end of the direct path load, UNIQUE constraints are verified and if a violation is detected, then the index will be left in an Index Unusable state. See "Indexes Left in an Unusable State".

Maybe you are looking for

  • Samsung TV automatic detection of MacBook

    I have a MacBook (Late 2009) and connect it to my TV via the DVI output and a HDMI cable. I would like to connect it when closed and use the TV as a monitor, using my iphone to access the computer. The problem is, when I connect the cables to my MacB

  • GX Won't boot, no display.

    We left the house during 4th of July weekend.  When we got back, my GX has stopped working.  When I turn it on, the HD light turns on, and stays on, but I can't hear it wind up at all.  The display shows nothing, not even a flicker of life.  The cool

  • LCD monitor too dark on Mac Mini

    I have tried both a Viewsonic VP730b and a Samsung 740BX and both are way too dark. Here's the wierd thing. If you unplug the DVI connector in the back, and plug it back in, the image looks good. But if you then restart the mini, the image goes back

  • Upgrade from 10.5.8 to 10.6 does not work on MacMini

    Hi I tried all advices given on the support pages, well, all but removing my boot volume, as I installed many different programs, but neither an upgrade nor an installation of snow leopard does work. I always get the message like: volume cannot be us

  • Hi,can anyone tell me how to fix error 4261, please help, thank you

    Would be most grateful for some help, as I can't burn onto disc, thank you