Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pb with sequence
Romuald Jouffrey wrote:
> create sequence mysequence;
>
> and then to use it to insert a new row:
> insert into oneofmytable values (mysequence.NEXTVAL, x1, ..... xn);
>
> oneofmytable is obviously already created and is empty !
> But this doesn't work ! If anybody has any clue, thanks in advance!
>
Maybe a Before-Insert trigger on the Table could handle the assignment
of a primary key value if the supplied value is null. Then you wouldn't
have to worry about it in any of your insert statements.
Then you could say...
"insert into oneofmytable values (NULL, x1, ..... xn);"
Alan Wilson