Re: Help:Pl/SQL Pass variable for sequence into SQL Select

From: Udo Voigt <cwk.software_at_rhein-neckar.netsurf.de>
Date: 1997/07/10
Message-ID: <33C49D40.22F6EA85_at_rhein-neckar.netsurf.de>#1/1


morris_gary_at_bah.com wrote:

> I'm somewhat of a beginner trying to write a fairly simple sequence
> .....
 

> FUNCTION getRpuInsert(Client IN VARCHAR2) RETURN NUMBER IS --
> Client=0021
 

> v_Result VARCHAR2(100);
> CURSOR c_getRpuInsert IS
> SELECT 's'||Client||'.NEXTVAL'
> FROM DUAL;
> BEGIN
> OPEN c_getRpuInsert;
> FETCH c_getRpuInsert INTO v_Result;
> RETURN v_Result;
> END getRpuInsert;
> _________

   Hi Gary,

try

    select sequence_name.nextval into v_Result from dual; (to get the actual number)

and then concat the string like

    Result := 's'||Client||'.'||v_Result; (if you want a dot in your result string)
or

   Result := 's'||Client||v_Result;

and then return the complete result string in Result.

it's only a hint.
I didn't test this possible solution.

best wishes and good luck
Udo Received on Thu Jul 10 1997 - 00:00:00 CEST

Original text of this message