Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem with PL-SQL
If you want to return at most 20 characters, you can:
RETURN(SUBSTR(l_my_var, 1, 20));
If you want to retun _exactly_ 20 characters:
RETURN(LPAD(SUBSTR(l_my_var, 1, 20)), 20); or
RETURN(RPAD(SUBSTR(l_my_var, 1, 20)), 20);
In article <7jg1ut$b2j$1_at_news.inet.tele.dk>,
"Morten Steen" <no_spam_at_forget.it> wrote:
> Hello there
>
> All you have to do is like this:
> CREATE OR REPLACE FUNCTION TEST(VALUE IN NUMBER) RETURN VARCHAR2 IS
> BEGIN
> RETURN('20 CHARACTERS???');
> END;
>
> This should work RETURN VARCHAR(20) has been replaced with RETURN
VARCHAR2
>
> Regards
> Morten
>
> Maciej BEDNARSKI skrev i meddelelsen
> <928739727.198346_at_casablanca.magic.fr>...
> >I would like to know, how can I return a VARCHAR(20) type in PL-SQL
> >function. I can't write this
> >CREATE OR REPLACE FUNCTION TEST(VALUE IN NUMBER) RETURN VARCHAR(20)
IS
> >BEGIN
> > RETURN('20 CHARACTERS???');
> >END;
> >
> >Must I declare a Subtype or other. Can you send me any samples of
code ?
> >
> >Thanks in advance.
> >
> >Regard
> >
> >Maciek
> >
> >
> >
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Mon Jun 07 1999 - 11:20:52 CDT
![]() |
![]() |