create trigger and use "nextval" to get next sequence nbr
aft5425Oct 30 2008 — edited Oct 30 2008Hi 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