Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL syntax help
In article <sd5dv3dvfja29_at_corp.supernews.com>,
"Ashwath Kakhandiki" <ashwath_at_bluedog.com> wrote:
> Hi everyone,
>
> I have two SQL query statements like this:
>
> SELECT ID FROM ID_TABLE
>
> set variable id = ID in Java code
>
> UPDATE ID_TABLE SET ID= "+ (id+1) + " WHERE ID=" + (id);
>
> Is there a safe way to do this so that it will succeed
>
> for all callers? It is supposed to return a unique,
>
> increasing number every time it's called.
>
>
No way. The only safe way to set unique numeric sequential ids is to use sequences. You might have holes in sequence (in case of rollbacks) but you won't have any duplicates.
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sat Mar 18 2000 - 23:39:37 CST