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.

.



Relevant Pages

  • Re: @@Identity
    ... like 6 posts ago in this thread. ... This value will auto increment when a new row is ... >> into a table that has an identity field. ... >> If you are inserting a row with your ADO.Net code that will increment ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: @@Identity
    ... like 6 posts ago in this thread. ... This value will auto increment when a new row is inserted ... > into a table that has an identity field. ... > If you are inserting a row with your ADO.Net code that will increment the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: @@Identity
    ... Scott, you obviously are an idiot. ... If you are inserting a row with your ADO.Net code that will increment the ... Assume you have 2 users that are both inserting a record in the same table. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Increment final value in for statement
    ... For more information on inserting and deleting rows and maintaining ... > When I run this lastrow doesn't increment and last row stays at the original ...
    (microsoft.public.excel.programming)

Loading