Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get available IDs?

Re: How to get available IDs?

From: Jadranko Lucic <jadranko.lucic_at_avl.com>
Date: Wed, 17 Jan 2001 10:14:04 +0100
Message-ID: <943nga$4in$1@fstgss02.tu-graz.ac.at>

Create objects below:

CREATE SEQUENCE YOUR_SEQ
 INCREMENT BY 1
 START WITH 1
 MINVALUE 1

 MAXVALUE 999999999999999999999999999

 NOCYCLE
 NOORDER
 CACHE 20
/

CREATE OR REPLACE
FUNCTION GET_ID
 RETURN INTEGER
 IS
x INTEGER;
  BEGIN
    SELECT YOUR_SEQ.NEXTVAL INTO X FROM DUAL;     RETURN x;
  END GET_ID;
/

To get "new free" id use:

SELECT GET_ID FROM DUAL; or strait from code either from pl/sql or client as pl/sql function



dipl. ing. Jadranko Lucic
AVL Zagreb
tel:++385 1 6551117
jadranko.lucic_at_avl.com
Received on Wed Jan 17 2001 - 03:14:04 CST

Original text of this message

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