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: How to set the size of string returned by PL/SQL functions?

Re: How to set the size of string returned by PL/SQL functions?

From: <fitzjarrell_at_cox.net>
Date: Thu, 04 Oct 2007 07:34:44 -0700
Message-ID: <1191508484.860647.314450@50g2000hsm.googlegroups.com>


On Oct 4, 9:23 am, "John Heitmuller." <john.heitmul..._at_jrfcorp.net> wrote:
> Hi, I have created a PL/SQL function that return a VarChar2. I then
> call that function in a view to provide one of the columns in the
> view. The string that the function returns can never be longer than
> 15 character. When I run a desc on the view it shows function column
> as VarChar(4000). Can I change I define a size for the VarChar2
> returned by the function?
>
> I've looked in the docs and I must just not be thinking about it in
> the correct context.
>
> Thanks,
> John

Use CAST to 'format' the varchar2 returned from the function:

create or replace view ..... as
select ...,..., ..., ... ,cast(myfunc(myparam) as varchar2(15)) mycol, ... from ... where ...;

David Fitzjarrell Received on Thu Oct 04 2007 - 09:34:44 CDT

Original text of this message

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