Primary key « Operation « Java Database Q&A





1. How to return Primary Key (auto increment) after an Insert    coderanch.com

There is a way in oracle(not sure if DB2 has the same capabilities). You can select the next sequence number from the database which will cause the counter to increase as if it was used by an insert. From there you can use the number to insert its value into the database as the primary key in the row...sorry...record for you ...

2. inserted primary key    coderanch.com

3. getting Primary key when inserting    coderanch.com

When I am inserting a row which contain primary key (generated by sequence), I want to get the sequence back after inserting the row in table. That key value I need to insert into child table. I am using Oracle 9i. I heard that there is some thing for this with Sybase. But don't know about the availability for Oracle. So ...

4. Primary Key. Auto update or manual update?    coderanch.com

Hello, I'm developing a web based database driven application. In my database tables, I have an integer column for primary key. Currently, I'm using the auto update of the mysql for the updating of primary key, whenever a new record is created. In some example applications that I have read, they do this manually. i.e. retrieve the value of last primary ...

5. how to get primary key after doing an insert    coderanch.com

#1. If you are not doing any validation on the zip code or storing any dependent fields like city/state, you don't really need to move it to another table. Let it be an attribute of the table. #2. There is a big debate about surrogate keys - Why won't you let the ZIP code be the primary key of the table ...