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 -> Hello, a question comparing sql server to Oracle

Hello, a question comparing sql server to Oracle

From: Mark <markg0001_at_hotmail.com>
Date: 1 May 2006 09:56:25 -0700
Message-ID: <1146502585.125271.73380@y43g2000cwc.googlegroups.com>


Hi, I want to insert into a table and have a primary key being a number. It is not important that this number is incremental so is allowed to have "holes". I don't want to assign the number in my Java code.

In Postgres and SQL Server I can set a column to be "autonumber" and the database automatically assigns it. Looking in Google it appears that this can't be done directly in Oracle. I have also checked and cannot find anything in the 10.2 manuals. I understand that I must "select sequencename.nextval into 'variablename' from dual" in a database trigger, then update :new.primarykeycolumnname with 'variablename'. If this is the only way of doing it then this is ok. But there is so much written in the newsgroup about pl/sql being slow so I don't want to code the trigger in pl/sql if there is a more efficient way of doing it.

Could someone please tell me if everything I have written above is correct. And what are my alternatives to improve speed if it is slow. I will be using Oracle 10.2 on RH.

Mark G. Received on Mon May 01 2006 - 11:56:25 CDT

Original text of this message

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