Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to set the size of string returned by PL/SQL functions?
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
![]() |
![]() |