Oracle sequence Field

Greeting,

I have a table in oracle contains a seq field named TranNum which incre by 1 when the user adds a new record from the web interface. I did a data import from the back-end and now the TranNum for new records on the interface is not max(TranNum)+1 from the back-end.

the sequence named PK_TBL_NAME.

How to reset the sequence to the current max(TranNum)+1?

Thanks.
mrongAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
You can alter the sequences INCREMENT BY value, select the next value then set INCREMENT BY back to 1
or
drop and create the sequence with the correct starting value.

https://community.oracle.com/thread/905417?tstart=0

Personally I like the drop and recreate.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
johnsoneSenior Oracle DBACommented:
Just be aware that drop and recreate requires that all the permissions be granted again.
0
Naveen KumarProduction Manager / Application Support ManagerCommented:
While loading your data from the backend, use the sequence number next value and that should automatically take care of this right. So there should be no need to alter the sequence values manually / reset it etc.

I guess you may be using sqlloader to load your backend data, in that case sqlloader does support referring to sequence next value.

Give it a try to test it out !

Thanks,
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.