문제

I'm having this error while trying to compile the following trigger :

CREATE OR REPLACE TRIGGER INCREMENTER_ID_CONSISTANCE 

BEFORE INSERT ON BD.CONSISTANCE 
for each row
BEGIN
:new.code := ID_CONSISTANCE.nextval;
END;  


**ERROR** : Table,View Or Sequence reference 'ID_CONSISTANCE.nextval' not allowed in
this context  

What is the problem here ? and how can I fix this ?

도움이 되었습니까?

해결책

This syntax is only allowed in Oracle 11 or later.

The (unsupported and outdated) 9i version did not support direct assignment of a sequence value.

You need to use a select into instead:

select ID_CONSISTANCE.nextval
  into :new.code 
FROM dual;

And you should really plan an upgrade to a current version of Oracle (11.x or 12.x)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top