oracle - PL/SQL Error on trigger for auto_increment -


i'm trying auto_increment cust_id field in following table:

create table a113222813_customers ( cust_id  number(10)  primary key, cust_fname varchar2(20), cust_sname varchar2(20), cust_uname  varchar2(30)  not null, cust_pass  varchar2(40)  not null ) 

i create following sequence , trigger handle this:

create sequence cust_seq start 1 increment 1 nocycle;  create or replace trigger cust_trg  before insert on a113222813_customers  each row  begin :new.cust_id := cust_seq.nextval; end; 

but keeps throwing following error:

error(2,30): pls-00357: table,view or sequence reference 'cust_seq.nextval' not allowed    in context 

any idea doing wrong?

this not possible before 11g. can use sequence_name.nextval in regular assignments 11g not before that, , following:

 select cust_seq.nextval :new.cust_id   dual; 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -