Re: How to limit the size of the returned value from a Stored Function?

From: Shawn Odekirk <shawno_at_erudite.com>
Date: 1996/11/12
Message-ID: <01bbd0ad$5f92dac0$100364c8_at_Shawno.erudite.com>#1/1


Matthias Koepf <mak_at_kis.datagroup.de> wrote in article <32885CC0.43CA_at_kis.datagroup.de>...
> Vahidt A. Tadjkarimi wrote:
> > I was wondering if it is possible to limit the size of a returned
> > value from a Stored Function. Here is a small example:
> > CREATE OR REPLACE FUNCTION plus_minus_f (val_1 IN NUMBER, val_2 IN
> > NUMBER) RETURN CHAR
> > IS
> > BEGIN...
> > END;
> > /
> > Once I call this function from a view or by itself the size of the
> > returned value is VARCHAR2(2000) !!! Any hints?
>
> We have exactly the same problem and need also help very urgent.
>
> One possibility we found is to call in the view definition the
> rpad-function with the SP and the the desired length as arguments. Then
> you get a varchar2(length)-Field.
>
> But this can't be the only way. We want to define the datatype somewhere
> else in the package or in the view definition.
> How can this be done ?
>
> Matthias Koepf
> mak_at_kis.datagroup.de

Not sure of this will work, but when you return the char can you do this? return(substr(string, 1, 5));

Or could you declare a local variable of the size you want, and then return that?

Hope this helps,
Shawn Received on Tue Nov 12 1996 - 00:00:00 CET

Original text of this message