Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Convert Mysql table schema to Oracle table
Oracle doesn't have automatic identies like Microsoft SQL. Whomever is
inserting the data into the table is still responsible for inserting a
valid key and keeping track of what is 'valid'. There are a couple of
ways to do it. The easy way is to "select max(id) from builds" and then
increment the result of the scalar select.
The better way to do it requires more work.
You have to create a sequance first.
CREATE SEQUENCE SEQ_BUILD_IDS INCREMENT BY 1 START WITH 1000;
Then before you do an insert you
"SELECT SEQ_BUILD_IDS.NEXTVAL FROM DUAL"
You then use the result of that query as the value for the id field
since you seem like you want that to be a self increment key value.
Received on Thu Mar 23 2006 - 11:25:51 CST