Re: Forms?: Single item, multiple records

From: DanHW <danhw_at_aol.com>
Date: 1998/04/21
Message-ID: <1998042103205700.XAA14360_at_ladder01.news.aol.com>#1/1


>Hello,
>
>Is there a way to make a single form item change the value in multiple
>records?
>
>Example: Pretend I have a STATE table and a CITY table. I have a
>"State" form that allows me to alter attributes for each state. On the
>"State" form I would like a single checkbox (or whatever) that lets me
>set a particular value for every city in that particular state.
>
>Thank in advance.
>
>Jason Boesch
>
>

This is one of the problems relational databases were invented to handle. If CITY uses values from the STATES table, they should not be duplicated in the CITY table, but referenced from the STATES table. However, reality being what it is, we can't always do it the way we want....

In the on-update trigger, update the State table, then update the City table. This will work fine unless you have a foreign key defined that connects the two tables. If you do, and you try this, you will get a mutating table error, or else invalid keys. There are several ways around the mutating table problem; my preferred method is to use database triggers (use a before-row update trigger on STATE to save the row(s) being updated to a PL/SQL array, then use an after-statement trigger to process the array, updating the rows in CITY to match the changes in STATE.

Hope this gets you started....

Dan Received on Tue Apr 21 1998 - 00:00:00 CEST

Original text of this message