Re: More than one table for a Triggers

  • From: Vitalis Jerome <vitalisman@xxxxxxxxx>
  • To: jacintakean@xxxxxxxxx
  • Date: Wed, 1 Jun 2005 13:02:15 +0200

On 6/1/05, Kean Jacinta <jacintakean@xxxxxxxxx> wrote:
> Hi :)
>=20
> I know that one trigger can be assign to only one
> table.
> I have a situation here, Below are all the tables
>=20
> mapped_table
> ----------
> mappedid --pk
> comid
> empid
> passportno
>=20
> company_table
> --------------
> comid
> comname
> employee_table
> ---------------
> empid
> empname
> passportno
>=20
> The mapped_table takes the value from two other table
> which is company and employee tables.
>=20
> A trigger name :autoinsert_mapped_tr
> This trigger will automatically takes value
> comid,empid,passportno from both company and employee
> table into mapped_table on insert and mappedid is a
> seq number.
>=20
> Since trigger is tied to one table, how can the above
> scenario be done? I didn't want to create 2 triggers ,
> one for company on insert and another triggers for
> employee on insert.
>=20
>=20
> Thank You
> Jkean

Hi,

Firstly, is this a schema you are current designing? If so, and if one
employee only works for one company, you should add a column comid in
employee_table and get rid of mapped_table.

Otherwise, you haven't explained precisely what comid your app should
use when inserting a row in mapped_table (after an insertion in
employee_table has occured).

Jerome
--
//www.freelists.org/webpage/oracle-l

Other related posts: