Seriously, Oracle…?

OK, so it looks like Oracle databases don’t have a quick, easy, non-triggery way to do an autoincrement the same way MS SQL, MySQL, postgres, and every other database on the planet have.  You have to create a “sequence” and then create a trigger to run use that sequence whenever data is inserted into the table.

Seriously?  Wow.

One page I came across in my search for a non-shitheaded way to do this describes this as being a more flexible way than having an auto-increment.  Go to that page and check out the code for MSSQL’s way vs. Oracle’s way.   One line of code versus about 20, plus you have to do it in 3 separate steps.  Using that page’s definition of “more flexible”, I guess a gnawed piece of bone is more flexible than a backhoe.

I imagine Oracle DBAs and developers probably have some quick scripts to let them add incremented keys more easily.  I’ll have to dig around and see.  Considering how much effort Oracle puts into their products as far as scalability and performance, I’m really surprised to see this kind of glaring omission.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: