Hi,
Im using Oracle 9i and writing a PL/SQL function and i need to get the sequence.nextval within the function. I am getting an error saying sequence does not exist. I have tryed the following :
select mySeq.nextval
into v_myvar
from dual;
but I still get the same error message. Is there any way to get the next value in a sequence from within a PL/SQL function.
Any help would be greatly appreciated.
ThanksCREATE SEQUENCE myseq;
CREATE OR REPLACE FUNCTION fun_seq
RETURN NUMBER
AS
retval NUMBER;
BEGIN
SELECT myseq.NEXTVAL
INTO retval
FROM DUAL;
RETURN (retval);
END;
/
SELECT fun_seq FROM DUAL;
FUN_SEQ
---
1|||Hi,
Thanks. I dont need to create a sequence because the sequence that I am using (mySeq) already exists on the database.
Thanks|||Figured it out. It was a permissions issue.
No comments:
Post a Comment