Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> [Q] How to get a blank number?
PROCEDURE GetBlankID()
........
........
I want to get number 3.
How to create procedure or function?
error code :
PROCEDURE GetBlankID()
IS
nIndex NUMBER(10) := 1;
nCmp NUMBER(10) := 1;
BEGIN
DECLARE CURSOR C_Pos IS
SELECT CID FROM TEST_TBL;
open C_Pos;
LOOP
FETCH C_Pos into nCmp;
EXIT when C_Pos%NOTFOUND;
IF nIndex <> nCmp THEN EXIT;
nIndex := nIndex + 1;
END LOOP;
CLOSE C_Pos;
INSERT INTO TEST_TBL(CID, CNAME) VALUES( nCID, 'reserved');
SELECT nCID AS 'BlankID';
END
Received on Tue Jun 18 2002 - 00:28:09 CDT