RE: brutally simple question - number of triggers on a table

  • From: "David Wendelken" <davewendelken@xxxxxxxxxxxxx>
  • To: "'Oracle-L'" <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 22 Apr 2005 16:15:13 -0400

>Whatever happened to the good old;
>
>select max(num_pk) from table; to populate the PK?  ;-)
>

Awhile back, I suddenly inherited a Cold Fusion application.

(Suddenly - as in my first day on the contract the only other programmer
informed me he had turned in his two-week notice some days ago - so I =
had to
take over his function plus do mine.)

I had never seen Cold Fusion before.

And, of course, there were some problems with the application.  :)

A huge percentage of them were caused by the programmer believing the =
advice
in Ben Forta's book on using Cold Fusion.

His advice to populate sequence generated primary key values was as =
follows:

1) Create a before insert trigger on the table to get the next value =
from
the sequence, and set the column to that value.

His advice on populating foreign key columns in child tables, right =
after
the parent record was created with the above method was as follows:

1) Select max(pk_col) + 1 from the_table.

2) Assign that value to the foreign key columns pointing to the just =
created
record.


So, the magic questions are:

a) What's wrong with Forta's approach?  (Include the symptoms you would
encounter.)

b) How many errors can you get in two weeks while 15,000 users are
frantically entering data into the system?

I'll answer "b" for you.  Thousands and thousands and thousands and
thousands.



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

Other related posts: