Connecting Tech Pros Worldwide Help | Site Map

Why do I have to manually make sequences and triggers for primary keys?

Member
 
Join Date: Aug 2007
Posts: 39
#1: Mar 11 '09
Hi All,

I'm an experienced MS SQL guy and I'm learning Oracle for my new job.
I've been asking around and apparently no-one has ever used a tool that would automatically create sequences for a primary key and the trigger that would go along with it to automatically populate the primary key field. You know something that is done in MS SQLServer with the click of a single button. ;-)

Along with that I would like a tool that would generate audit tables and the associated triggers for me based on a given table as well as the ability to reorder columns.

Does a freeware application like this exist?
If not I guess I'll take an afternoon and hack it out. :(

-Biff
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,500
#2: Mar 11 '09

re: Why do I have to manually make sequences and triggers for primary keys?


In oracle you need to define your own objects as desired.
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#3: Mar 11 '09

re: Why do I have to manually make sequences and triggers for primary keys?


You can use a TOAD,SQL Developers etc to create these objects. In TOAD you can create a SEQUENCE,DB LINK etc without writing much code. But NO it is not possible to associate SEQUENCE and TRIGGER by single click. You need to:

1. Create a SEQUENCE
2. Use that SEQUENCE in a TRIGGER to populate a Primary Key value
Member
 
Join Date: Aug 2007
Posts: 39
#4: Mar 11 '09

re: Why do I have to manually make sequences and triggers for primary keys?


Yeah I understand that is how you do it. My point is that we shouldn't have to write that out every time we make a new table. It should be done for us! I'm lazy and I want to create applications fast. Any extra steps beyond defining a schema should be automatic!
Some bright boy out there must have made something to do this for us....
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,500
#5: Mar 12 '09

re: Why do I have to manually make sequences and triggers for primary keys?


come out of your laziness and start writing the code.
Member
 
Join Date: Aug 2007
Posts: 39
#6: Mar 12 '09

re: Why do I have to manually make sequences and triggers for primary keys?


I don't understand Oracle people, everywhere I've asked I get the same answer. "Just code it"
Why do things the long, hard, boring way?

I prefer the short, easy, exciting way.
It doesn't matter anyhow as I've already written my own app to do this for me.
2 hours of my time is worth it to never have to code a sequence, trigger or audit table again.
Biff - 1 Oracle - 0

-Biff
Reply

Tags
audit tables, code, generation, sequences, triggers