Re: mutating table error w/trigger

From: Guido Konsolke <Guido.Konsolke_at_triaton.com>
Date: Tue, 29 Jul 2003 08:59:08 +0200
Message-ID: <1059461780.349699_at_news.thyssen.com>


Hi Robert,

ok, the thread is long enough.
There is absolutely no problem
modifying :NEW columns in a
'BEFORE INSERT FOR EACH ROW' trigger.

You must have made a simple mistake.

Look at this snippet from my sql session:

08:47:50 to85e>create table gktest

(datum1 char(8),datum2 date);
Table created.
 real: 110
08:48:17 to85e>insert into gktest

(datum1)

               values ('01012003');
1 row created.
 real: 30
08:53:46 to85e>select * from gktest;
DATUM1 DATUM2
-------- ---------
01012003 01-JAN-03
 real: 20
08:53:53 to85e>

And here's the trigger code:
create or replace trigger tr_gktest_BIR
  before insert on gktest
  for each row
declare

  • local variables here begin :new.datum2 := to_date(:new.datum1,'ddmmyyyy'); end tr_gktest_BIR;

That's all you need. Now go on with
this and play.

Greetings,
Guido Received on Tue Jul 29 2003 - 08:59:08 CEST

Original text of this message