Re: Oracle sequence returning duplicate key for a given key name
Date: Fri, 7 Mar 2008 13:58:00 -0800 (PST)
On Mar 6, 10:13 pm, vijay <vksingh..._at_gmail.com> wrote:
> Tool - VC2005, OleDb
> Database - Oracle 10g
> OS - Window 2003 Server
> We have developed oracle stored procedure to generate unique key for a
> given key name. Stored procedure uses sequences to return new key.
> create or replace PROCEDURE ABI_SP_GETNEWLOGKEY
> (strkeyname IN VARCHAR2, nkeyvalue OUT NUMBER )
> EXECUTE IMMEDIATE 'SELECT abi_' ||strkeyname ||'.NEXTVAL FROM
> INTO nkeyvalue;
> WHEN OTHERS THEN
> EXECUTE IMMEDIATE 'create sequence abi_' || strkeyname || '
> INCREMENT BY 1 START WITH 1 MINVALUE 0 NOCYCLE NOCACHE';
> Above stored procedure is being called from multi threaded vc++
> application. VC++ application uses OleDb to call sp. Some time stored
> procedure return duplicate key for a given key name.
> Can anyone suggest me what could be reason.
> Thanks in advance.
> Vijay Singh
You did not post the original DDL for creating the sequences. Is it possible that the originals are either created with a lower than needed maxvalue and cycled and thus causing the problem? Received on Fri Mar 07 2008 - 15:58:00 CST