Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting from a sequence based on a variable name?
On Sun, 23 Aug 1998 22:20:15 +0100, "Alexander Bisset"
<alexander_at_bisset.demon.co.uk> wrote:
>begin
> strSeqName := 'sequence_' || to_char(seqYear);
> select strSeqName.nextval into intSeqNum from dual;
> return intSeqNum;
>end;
>
>This does not work, but hopefully you get the idea. I need some method of
>selecting the next sequence number from one of many sequences based on a
>variable passed into the function.
You need to use the DBMS_SQL package. It's documented in the Application Developer's Guide. Essentially, it lets you build up dynamic SQL statements as character strings, and then execute same.
regards,
Jonathan Gennick Received on Sun Aug 23 1998 - 22:38:34 CDT
![]() |
![]() |