Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Alternatives to Sequences?
I haven't tested this out, so it might not work, but this might do the
trick as long as the software program does not 1) log into the database
using the account which is the owner of the schema where the tables are
located. 2) Does not use owner.tablename to access the tables 3) Access the
tables via a synonym.
cspeer_at_my-deja.com wrote:
>
> 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.)
![]() |
![]() |