Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: I'm sorry, another dumb question about Triggers
"tk" <theronk_at_charter.net> wrote in message
news:vj4mfs6sii9u3c_at_corp.supernews.com...
> I promise to keep my questions to a minimum after this... Pardon my
> ignorance but I'm going thru the trigger examples in the Oracle 8i PL/SQL
> book. p. 270 has the following trigger:
> --------
> CREATE OR REPLACE TRIGGER GenerateStudentID
> BEFORE INSERT OR UPDATE ON students
> FOR EACH ROW
> BEGIN
> /* Fill in the ID field of students with the next value from
> student_sequence. Since ID is a column in students, :new.ID
> is a valid reference. */
> SELECT student_sequence.NEXTVAL
> INTO :new.ID
> FROM dual;
> END GenerateStudentID;
> --------
> I understand clearly what this is doing. However, I'm dumbfounded as to
> "why" they have this also called on an UPDATE statement?
> When I issue the following update:
>
>
>
I would agree with you whole heartedly. NEVER update a primary key. Remove the words "OR UPDATE" to make it a much more reasonable trigger. > Received on Thu Aug 07 2003 - 09:52:37 CDT
![]() |
![]() |