Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: brutally simple question - number of triggers on a table

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

From: David Wendelken <davewendelken_at_earthlink.net>
Date: Fri, 22 Apr 2005 16:15:13 -0400
Message-ID: <009b01c54777$fe20f420$6401a8c0@davidwendelken>

>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:

  1. What's wrong with Forta's approach? (Include the symptoms you would encounter.)
  2. 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.

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Apr 22 2005 - 15:59:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US