Eric
Eric

Reputation: 1020

Oracle Forms - Master - Detail Issues

I have a form that contains a tab canvas.

On the second canvas page I have two data blocks with a master detail relationship.

The first block (master) is driven by a table (table_one) with the following fields:

sf_id (PK)
sf_code - VARCHAR2(40)
sf_desc - VARCHAR2(250)

The second block (detail) is a repeating block driven by a table (table_two) with the following fields:

error_code - VARCHAR2(40
error_code_desc - VARCHAR2(250)
is_major_error - VARCHAR2(1)
error_type - VARCHAR2(1)
error_is_active - VARCHAR2(1)
update_date - DATE
sf_id (FK - table_one.sf_id)

The second block only shows error_code and error_code_desc. The point of this canvas page is to add/remove master records and associate detail records with a master. I never want to actually insert or remove records from table two; merely updating the sf_id column in table two.

What I am trying to achieve is the following:

  1. Create a master record with detail records at the same time.

  2. Delete a master record

  3. Add and remove detail records

An insert into the detail block is nothing more than associating a master record with a detail record by updating the sf_id column in table two. A delete from the detail block is nothing more than setting the sf_id column to null in table two. I am not actually adding or removing records in table_two. Does this make sense?

I have tried overriding the commit on the second block to perform updates instead of Oracle actually trying to insert NEW records into table_two.

Upvotes: 0

Views: 3608

Answers (1)

GriffeyDog
GriffeyDog

Reputation: 8376

Try overriding the ON-INSERT trigger for your detail block. Make sure it's a complete override and not fires-before or fires-after. Then do your update instead of the default insert process.

Upvotes: 1

Related Questions