Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

create trigger and use "nextval" to get next sequence nbr

aft5425Oct 30 2008 — edited Oct 30 2008
Hi i created a table and a primary key for that table as follows:

create table PROD_TRNSLTN
(
PROD_PK VARCHAR2(16),
CNTRC_CD VARCHAR2(10),
PROD VARCHAR2(10),
PLN VARCHAR2(10)
);

alter table PROD_TRNSLTN
add constraint PROD_TRNSLN_PK primary key (PROD_PK);



i then created a trigger to automatically populate the primary key

create trigger PROD_TRNSLTN_TRGR
before insert on PROD_TRNSLTN
for each row
begin
Select PROD_PK.nextval into :new.PROD_PK from dual;
end;

i get no syntax error, but when i use SQLLoader to insert rows into this table i get:
"ORA-04098: trigger 'IAVE.PROD_TRNSLTN_TRGR' is invalid and failed re-validation"

Why??

Edited by: aft5425 on Oct 30, 2008 11:37 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 27 2008
Added on Oct 30 2008
7 comments
383 views