Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Convert Mysql table schema to Oracle table

Re: Convert Mysql table schema to Oracle table

From: Jon <jonathan.p.crawford_at_gmail.com>
Date: 23 Mar 2006 09:25:51 -0800
Message-ID: <1143134751.705075.326190@j33g2000cwa.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US