How to alter the constraint for on delete cascade

10-11  Source: Network gathering  Views:0 

Advertisement
Hi Guys,
I have a table which has 5 level of child tables .But all the child tables have the foreign keys without on delete cascade.But I have to delete a data in the parent table .One method I thought to change the child table constraints to ON DELETE CASCADE then delete the record and after that again to change the constraints with out the ON DELETE CASCADE.Please let me know wheather these is possible or not .If not is there any other alternatives to achive this.
Any suggestions would be highly appreciated.
Thanks in advance
Prafulla
I think you need to drop and recreate your FKs.
See my example here.
create table TEST1
  id       NUMBER(12) not null,
  anything VARCHAR2(20)
alter table TEST1
  add constraint PK_TEST1 primary key (ID);
create table TEST2
  id2  NUMBER(12) not null,
  fk1  NUMBER(12),
  info VARCHAR2(50)
alter table TEST2
  add constraint PK_TEST2 primary key (ID2);
alter table TEST2
  add constraint FK_TEST2_TO_TEST1 foreign key (FK1)
  references TEST1 (ID);
-- and here is the code when I add on delete cascade for FK
alter table TEST2
  drop constraint FK_TEST2_TO_TEST1;
alter table TEST2
  add constraint FK_TEST2_TO_TEST1 foreign key (FK1)
  references TEST1 (ID) on delete cascade;
Related articles
  • How to alter the constraint for on delete cascade 10-11

    Hi Guys, I have a table which has 5 level of child tables .But all the child tables have the foreign keys without on delete cascade.But I have to delete a data in the parent table .One method I thought to change the child table constraints to ON DELE

  • Modify constraint for "on delete cascade" 11-30

    hello all, i have a table with a foriegn key to another table. this constraint define no action on delete on create time. but i want to modify this constraint for "on delete cascade" now. i entered following sql but get an error. how can help me

  • How to set the conditions for item deletion approval workflow? 10-11

    Hi, I have created approval workflow for item modifications ie, when user try to modify an item, it will send a mail to Project Manager. For that I set the conditions in Change the behavior of the overall task: 1. When the task process starts 2 . Whe

  • How to unlock the request for a report and add the same query to new reques 11-30

    hi,      how to unlock the request for a  and add the same query to new requesYou can unlock in SE03 tcode. Goto tcode SE01, give the transport number --> display --> double click on the transport --> in the next screen select all the elements --

  • In VB Programming code -- How to access the formula for suppressing a field 10-11

    In VB Programming code -- How to access the formula for suppressing a field I am using Crystal Reports 2008 v1 Using VB code, I am attempting to modify a Crystal Report before exporting it into a PDF format and then displaying it on the Web. My probl

  • How to obtain the license for the mentioned products. 10-11

    Hi All, Please help me in below licensing issues. 1) Our functional team got the below error while accessing "Job Scheduling Workbench". Error: The Workbench is inaccessible because Oracle Manufacturing Scheduling has not been licensed. Please w

  • A^b = n ,How to get the value for a ? 10-11

    a^b = n ===> n = Math.pow(a,b) How to get the value for a ? dose Java have API to get the value for a ? Thanks for help~~~a^b = n => a = n^(1/b) So, a = Math.pow(n,1.0/b)Read other 3 answers

  • How to get the date for the first monday of each month 10-11

    Dear Members, How to get the date for the first monday of each month. I have written the following code SELECT decode (to_char(trunc(sysdate+30 ,'MM'),'DAY'),'MONDAY ',trunc(sysdate+30 ,'MM'),NEXT_DAY(trunc(sysdate+30 ,'MM'), 'MON')) FROM DUAL But it

  • Reading from a file. How to ask the user for file name at run time???? 10-11

    I have the code to read from a file but my problem is how to prompt the user for the file name at run time. import java.io.File; import java.io.FileNotFoundException; import java.util.InputMismatchException; import java.util.Scanner; public class Fil

  • How to restrict the GR for Production Order when Goods Issue is not done 10-11

    Hi Gurus How to restrict the GR for Production Order when all the required components for production order are not issued with all required quantity. Even for partial issue system should not allow GR with 101. The user status with RMWA, RMWF & CGFB i

  • How to get the ItemKey for a Workflow triggered by an event in Oracle Apps 10-11

    Hello, I have added a custom sub process to the seeded "OM Order Header" workflow. The process sends a notification. There are a few attributes in the body of the message tied to this notification, to which I am trying to assign values to using

  • How to setup the RV120W for quickvpn 10-11

    Hello, The PPTP client from Windows 7 is not working with this router; therefore I would like to try the quickvpn. Is there any paper from Cisco explaining how to setup the RV120W for quickvpn ? Thanks for any helpUser Guides for thee rv120W are here

  • How to get the order for these decoration​s? 10-11

    hello, I want to programatically resize all the controls, indicators and decorations on the front panel. I am getting the references of all the controls and indicators and able to resize them, as each n every control and indicator has a tabbing order

  • I cannot find how to change the language for labels in a quiz 10-11

    I cannot find how to change the language for labels in a quizYou have to be aware that this will only change labels if you edit before adding quiz slides: Preferences, Quiz, Default Labels. You will have to edit the labels, choosing another language

  • How to change the icon for print dialog? 10-11

    Hello, I have a JTable, and with the print() method, I'm able to bring up the Print dialog and successfully print the contents of the table. Example: myTable.print( JTable.PrintMode.FIT_WIDTH, myHeaderFormat, myFooterFormat );This works great, but on

  • How to change the Icon for a JFileChooser ? 10-11

    Has anyone figured out how to change the icon for an instance of JFileChooser from the coffee cup to something else? I'm on 1.4 Thanks, KenNever mind. I figured it out. You have to use an instance of JFrame in the call to showXxxxDialog(Component c).

  • How to change the color for HTML words in JEditorPane? 10-11

    Hi Sir, In the JTextPane , we could change the word's color by using: Style style = doc.addStyle("test",null); StyleConstants.setForeground(style, Color.red); doc.setCharacterAttributes(10,20,syle,true); we can change the text into red color,whi

  • How to enable root on mac on 10.9.2 and how to set the password for the same ? 10-11

    how to enable root on mac on 10.9.2 and how to set the password for the same ?http://support.apple.com/kb/ht1528 Follow the steps for Lion. But, why are you doing this? I've never found the need to do that.Read other 2 answers

  • How to use the API for DATE, MONTH  AND YEAR 10-11

    I would like to use the java api in .util.calender in the java api to get the date. How to implement the API for the "DATE","MONTH","YEAR" which are available provide by java? can someone give me in one complete code?From the

  • How to capture the screen for sending the mail 10-11

    dear sir,                   How to capture the screen for sending the mail .. Is there any funtion module or anyother way ? .. How to do this .. Please tell me.. Regards, Kumardear sir, s thats my problem ? Regards, kumarRead other 3 answers