Home » Developer & Programmer » Forms » Deleting Master Detail Records
Deleting Master Detail Records [message #134847] Sun, 28 August 2005 02:40 Go to next message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

Dears

I have one master block and two detail block corresponding to only single master block. When i delete the record, i want the delete operation will occure in all the tables i.e. from all the three table the records are deleted what i have to do. I have tried to make the two relation ship to be cascade but this is not working. Pls help me it is urgent.

Samit Gandhi
Re: Deleting Master Detail Records [message #134866 is a reply to message #134847] Sun, 28 August 2005 09:59 Go to previous message
hamdard
Messages: 37
Registered: July 2005
Member
hi,
what type of relationship exists in your master and detail tables.
Check this below. It is working properly.
SQL> CREATE TABLE dept_master
  2  AS SELECT * FROM scott.dept;

Table created.

SQL> CREATE TABLE emp_detail1
  2  (empno NUMBER, deptno NUMBER);

Table created.

SQL> CREATE TABLE emp_detail2
  2  (ename VARCHAR2(32), deptno NUMBER);

Table created.

SQL> ALTER TABLE dept_master
  2  ADD CONSTRAINT empm_deptno_pk PRIMARY KEY(deptno);

Table altered.

SQL> ALTER TABLE emp_detail1
  2  ADD CONSTRAINT empd_deptno_fk FOREIGN KEY(deptno)
  3  REFERENCES dept_master(deptno);

Table altered.

SQL> ed
Wrote file afiedt.buf

  1  ALTER TABLE emp_detail2
  2  ADD CONSTRAINT empd2_deptno_fk FOREIGN KEY(deptno)
  3* REFERENCES dept_master(deptno)
SQL> /

Table altered.

Now I created the form and created the relation in the tables. This form consists of one master table and two detail tables.
I just opened the property pallet of two relations and changed Delete Record behaviour property to Cascading. Now I polulated the records and saved. After I delete the master record, child records are also deleted from both the detail tables.

I'm not guessing how you'r making the cascading behaviour in your form and if you have the proper constraints on your tables or not.

Please give some more details.

Regards.
Previous Topic: Dynamic List Box
Next Topic: create button to search
Goto Forum:
  


Current Time: Thu Sep 19 23:31:49 CDT 2024