Sequence_Creation

Hi Expert,

We create sequence with Trigger has good idea or simply used sequence start with 1, increment by 1 in oracle.

Please suggest which one is good choice and why ??

Thanks in Advance .
MIHIR KAR#Hadoop #Oracle_DB #UNIX beginnerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Pawan KumarDatabase ExpertCommented:
sequence start with 1, increment by 1 in oracle
This one is good.

But before that please tell us your complete requirement? What you are trying to achieve?
0
Gerwin Jansen, EE MVETopic Advisor Commented:
>> We create sequence with Trigger
You create a sequence by means of a trigger? A sequence is usually not created by a trigger but during setup or modification of a table.
0
slightwv (䄆 Netminder) Commented:
I assume by trigger you mean go find the greatest value and add 1 to it.  That is HORRIBLE and should NEVER be done.

Why:  It can take a lot of SQL time to generate the MAX and it doesn't get you anything.   They can also lead to duplicate values.

Oracle sequences are fast to increment and cannot generate duplicates.

Assuming the next part of the question:
Neither by themselves will generate gapless numbers.  It is rare that you MUST have them.  Most of the time DBAs/Developers/Analysts just like them but really don't have a requirement to have them.
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
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.