insert of a pk value number generated from sequence fails [message #375173] |
Thu, 02 August 2001 09:59 |
Andreas Stutzki
Messages: 2 Registered: August 2001
|
Junior Member |
|
|
I wrote a simple before - insert trigger, that inserts a number - value generated by a sequence into a pk - column.
create or replace trigger adress_pk
before insert on evi_ora_p1.adrglob
for each row
declare
pk number;
begin
select medas_seq_1.nextval
into pk
from dual;
insert into adrglob(Glob_Adresseid)
values(pk);
end;
The trigger will be compiled without errors. If i try to unsert a new value into the table a
ORA-00036 error occurs followed by a ORA-04088 and an ORA-06512 error message. Does anybody know the how to fix the problem - thanks in advance.
|
|
|
Re: insert of a pk value number generated from sequence fails [message #375176 is a reply to message #375173] |
Thu, 02 August 2001 12:35 |
Senthil
Messages: 68 Registered: December 1999
|
Member |
|
|
where is the problem...works for me...
SQL> create sequence user_seq start with 1;
Sequence created.
SQL> create table t1 (no number);
Table created.
SQL> create table t2 (no number);
Table created.
SQL> create or replace trigger t1_trig_ins before insert on t1
2 for each row
3 declare
4 pk number;
5 begin
6 select user_seq.nextval into pk from dual;
7 insert into t2 values (pk);
8 end;
9 /
Trigger created.
SQL> insert into t1 values (5);
1 row created.
SQL> select * from t1;
NO
----------
5
SQL> select * from t2;
NO
----------
1
SQL> commit;
Commit complete.
|
|
|
|