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 -> Alternatives to Sequences?

Alternatives to Sequences?

From: <cspeer_at_my-deja.com>
Date: Mon, 27 Sep 1999 21:10:09 GMT
Message-ID: <7somf8$tfk$1@nnrp1.deja.com>


Hello everyone,

     We purchased a software program that ties into an Oracle database. We noticed that there are no primary/unique keys on the tables. We are adding an auto-incrementing field... And herein the problem lies:

     In order to do an insert with an auto-incrementing field, you would normally create a sequence and then reference it in your INSERT INTO clause. However, we do not have that option since we cannot rewrite the code of the software that creates the statement. (We have dutifully cursed them and they are working on fixing it.)

     What alternatives do we have to do auto-incrementation. I heard from the software company, that you can create a field-type that increments in Oracle, but a) I don't belive it and b) I have not found any reference to it anywhere in documentation.

     So is there a field type in Oracle (even non-standard) that I can use to auto-increment?

     I am beginning to think that I will have to write a Trigger/Stored Procedure that will accomplish this. (ie, on insert, update the auto- incrementing field with max+1).

     References to articles would greatly help (especially if there is a reference on writing the trigger.)

Thank you!

CW Speer
Oracle DBA (Newbie!)

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Sep 27 1999 - 16:10:09 CDT

Original text of this message

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