Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Are Triggers Really that Bad or ....???
> > I am facing a wierd situation here.
> >
> > We have a database with around 150-200 Tables and growing . Each
> Table has
> take
> and when
> one of
> implement
> this but
> this
Business rules *should belong* in the database and I think everyone here has roundly supported that idea. Specially when there could be multiple front ends...Win32 application based, browser based etc. It's much easier to rewrite/port a thin client then trying to rewrite/port business logic.
As far as the Triggers go, IMO... they should not be used to perform validation and referential integrity. Keeping in mind that data is the most important commodity in the database...One biggest caveat with Triggers is that if they quietly get disabled due to unknown reasons, users will not know anything about it because disabled triggers do not raise any errors...and if a trigger is used to do data validation or referential integrity...then the damage could be very painfull. Triggers are well suited for data replication.
IMO, data validation, referential integrity, inserts, updates and deletes should be done via a stored procedure... Here is why.
In the original posters case,
An insert procedure...
CREATE OR REPLACE PROCEDURE insert_ (
col1_ IN ...., col2_ IN ...., col3_ IN .... ) IS user_ .....;
Call this procedure from client and pass appropriate parameters. Update and delete procedures can be setup this way and all this code can be managed in a package.
Since the topic of this thread is "Are Triggers Really that Bad or ....???"... and IMO, triggers are bad when they are *misused*.
If your senior developer wants to use triggers due to project time/money constraints, then maybe you should go with it. However, it is always a good idea to explore all possible solutions. A well planned design up front can save a lot of time and money in the long run.
Regards
//Rauf Sarwar
Received on Thu Aug 15 2002 - 01:19:28 CDT
![]() |
![]() |