Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Help returning VARCHAR2 from a function

Re: Help returning VARCHAR2 from a function

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 05 Aug 1998 13:15:24 GMT
Message-ID: <35c85a2b.1391951@192.86.155.100>


A copy of this was sent to "Troy Fruetel" <Troy.Fruetel_at_connects.com> (if that email address didn't require changing) On Thu, 30 Jul 1998 10:34:03 -0500, you wrote:

>Please respond by e-mail to
>Troy.Fruetel_at_connects.com
>
>
>I've created a function that returns a VARCHAR2, but the function fails if
>the value to be returned exceeds 200 characters. I want to be able to
>return VARCHAR2(1000), but that's not allowed. So I created a user-defined
>subtype of a variable that was VARCHAR2(1000), but that didn't help either.
>Any ideas?
>

What error do you get when you return >200 characters? you can return 2,000 characters in v7 and 4,000 character in v8 from a function called from SQL. For example:

SQL> create or replace function foo return varchar2   2 as
  3 tmp varchar2(2000);
  4 begin

  5          tmp := rpad( '*', 2000, '*' );
  6          return  tmp;

  7 end;
  8 /

Function created.

SQL> select foo, length(foo) from dual;

FOO              LENGTH(FOO)
-----            -----------

****...(snip'ed) 2000

>Neither of the following two methods work:
>
>GetExpression(ExpressionSeqID Number) RETURN VARCHAR2;
>
>temp VARCHAR2(1000);
>SUBTYPE ExpressionText IS temp%TYPE;
>GetExpression(ExpressionSeqID Number) RETURN ExpressionText;
>
>
>Thanks
>Troy Fruetel
>Connect
>
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Aug 05 1998 - 08:15:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US