PL/SQL (MOSC)

MOSC Banner

need a little help with this syntax - nextval to auto-populate not null field from sequence

edited Oct 14, 2009 10:27AM in PL/SQL (MOSC) 2 commentsAnswered
 Hello.  I'd really appreciate some help on checking what is wrong with the trigger to the table.  here is a sample of what i've created & the error I'm getting - the error is occuring when I try to add the trigger to the table:

create table person(person_id NUMBER(5,0) NOT NULL, given_name VARCHAR2(50), middle_name VARCHAR2(50), family_name VARCHAR2(50), constraint person_id_pk primary key (person_id))

 

CREATE SEQUENCE person_seq
			
 START WITH     20
			
 INCREMENT BY   1
			
 NOCACHE
			
 NOCYCLE;
				
	

SELECT person_seq.nextval

    FROM DUAL;

------------------------------------------------------------

insert into person(person_id,given_name,middle_name,family_name) values (person_seq.nextval,'Robert','E.','Lee')

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center