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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 10G and Trigger Problem

Re: Oracle 10G and Trigger Problem

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Thu, 16 Feb 2006 20:46:21 +0100
Message-ID: <dt2k34$49g$1@news2.zwoll1.ov.home.nl>


Nicolas Bronke wrote:
> I have an Oracle 10G Enterprise Edition 10.2.0.1.0 with a standard
> installation on XP-Pro. Now I detected a strange behaviour. I made a
> reproducable example>
>

You are not telling the whole story...
This is what I get, and what I would expect: BTW This is 9.2.0.6/Win:

SQL> create table blah (col1 varchar2(32)); Table created.

SQL> alter table blah add constraint blah_pk primary key(col1); Table altered.

SQL> insert into blah values(user);

1 row created.

SQL> create trigger blah_tgbi
  2 before insert on blah
  3 for each row
  4 begin
  5 :new.col1 := upper(:new.col1);
  6 end;
  7 /
Trigger created.

SQL> insert into blah values(user);
insert into blah values(user)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.BLAH_PK) violated

SQL> delete from blah;
1 row deleted.

SQL> insert into blah values(user);
1 row created.

No problem here... neither on 10.1.0.4/Linux: Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production With the Partitioning, OLAP and Data Mining options

SQL> create table blah (col1 varchar2(32)); Table created.

SQL> alter table blah add constraint blah_pk primary key(col1); Table altered.

SQL> insert into blah values(user);
1 row created.

SQL> delete from blah;
1 row deleted.

SQL> create trigger blah_tgbi
  2 before insert on blah
  3 for each row
  4 begin
  5 :new.col1 := upper(:new.col1);
  6 end;
  7 /
Trigger created.

SQL> insert into blah values(user);
1 row created.

SQL> commit;
Commit complete.

-- 
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Received on Thu Feb 16 2006 - 13:46:21 CST

Original text of this message

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