Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie Question on Function
Try:
CREATE OR REPLACE FUNCTION DEPID2
RETURN NUMBER IS
A_INT NUMBER(10,0) ;
BEGIN
select DEPTID_SEQ.nextval
into A_INT
from dual;
Return(A_INT) ;
END DEPID2 ;
You don't need the schema owner because you're compiling it in the schema
that owns the sequence object. You need to select the sequence.nextval
*from* some table.
--
- Dan Clamage
http://www.telerama.com/~dclamage
If you haven't crashed the Server,
you haven't been trying hard enough.
Eric Jodoin <ejodoin_at_inetex.com> wrote in article
<35b3d3b4.0_at_204.239.181.11>...
> Hi,
>
> I am trying to have a function return a sequence.Nextval but it just
> doesn't work!
>
> 1st I created the Sequence (This worked OK)
> The sequence Name is: DEPTID_SEQ
>
> Then I created the Function but I get compile errors
> Here two of my tries (I tried dozens):
>
> CREATE OR REPLACE FUNCTION "CSS_User".DEPID2
> RETURN INTEGER IS
> BEGIN
> RETURN(DEPTID_SEQ.NEXTVAL) ;
> END ;
>
> I also tried
>
> CREATE OR REPLACE FUNCTION "CSS_User".DEPID2
> RETURN INTEGER IS
> A_INT NUMBER(10,0) ;
> BEGIN
> select DEPTID_SEQ.nextval
> into A_INT ;
> Return(A_INT) ;
> END ;
>
> Can someone tell me What I am doing wrong please ???
>
> eric
> ejodoin_at_inetex.com
>
>
>
>
>
>
>
Received on Mon Jul 20 1998 - 20:11:22 CDT
![]() |
![]() |