How to reset IDENTITY column in oracle to a new value -


i using identity feature of oracle 12 c increment record id of table.
as part of initial setup have migrate records system table. these records non sequential records(partial records deleted).

how make identity create highest value + 1 based on table records.

after googling different options found keyword of restart with value option. need create new store procedure , alter tables highest possible values restart with.

is there direct keyword can used along identity can force regenerate higher values. ?

no direct keyword , have alter table (right words start with).
there's way change highwatermark identity column. common sequences (by way identity built on system sequence) use old trick increment shifting mark in directions.

alter table t modify (id number generated identity increment 50 nocache); 

that is, if next value 100 , need make 1000, trick 2 times: "increment 900", add record , "increment 1" (if identity step 1).


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -