Re: Function Results

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/07/17
Message-ID: <31ec4fa8.17652442_at_dcsun4>#1/1


On Tue, 16 Jul 1996 13:04:27 -0400, Tom Gerahty <tg19905_at_glaxo.com> wrote:

>We have created a function that returns varchar string.
>The function works fine except it returns a 2000 byte
>string regardless of the length of the result. Is there a
>way to influence the lenght of the output? Doc says the
>return length cannot be provided because system determines
>it. Any thoughts? Has anyone come up with a creative
>get-around? Thanks in advance.
>
>Tom Gerahty
>Glaxo Wellcome
>gerahty_at_ibm.net

This doesn't sound right, for example:

create or replace function getstring( n in number ) return varchar2 is
begin

    return rpad( '*', n, '*' );
end;
/

  1 select length(getstring(rownum)) from all_users   2* where rownum < 10
SQL> /   LENGTH(GETSTRING(ROWNUM))


                        1
                        2
                        3
                        4
                        5
                        6
                        7
                        8
                        9

a varchar is a varchar, it doesn't have a constant length. How about seeing some of the code, are you inadvertently padding it out somewhere?  

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Wed Jul 17 1996 - 00:00:00 CEST

Original text of this message