Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get available IDs?
Create objects below:
CREATE SEQUENCE YOUR_SEQ
INCREMENT BY 1
START WITH 1
MINVALUE 1
MAXVALUE 999999999999999999999999999
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
![]() |
![]() |