The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question, JOSHI.
Asked: January 18, 2021 - 9:58 am UTC
Last updated: January 19, 2021 - 1:23 pm UTC
Version: PL/SQL Release 11.2.0.1.0 - Production
Viewed 1000+ times
create table t ( c1 int generated by default as identity primary key ); begin for i in 1 .. 9 loop insert into t values ( default ); end loop; insert into t values ( 10 ); insert into t values ( 20 ); commit; end; / insert into t values ( default ); ORA-00001: unique constraint (CHRIS.SYS_C0024541) violated alter table t modify c1 generated by default as identity ( start with limit value ); var id number; insert into t values ( default ) returning c1 into :id; print :id ID ---------- 21
create sequence s; select s.nextval from dual; NEXTVAL 1 alter sequence s restart start with 99; select s.nextval from dual; drop sequence s; NEXTVAL 99
The Oracle documentation contains a complete SQL reference.