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, 3:01 pm, "fitzjarr..._at_cox.net" <fitzjarr..._at_cox.net> wrote:
> On Oct 4, 1:45 pm, madhusree..._at_gmail.com wrote:
>
> > On Oct 4, 9:37 am, "John Heitmuller." <john.heitmul..._at_jrfcorp.net>
> > wrote:
>
> > > > create or replace view ..... as
> > > > select ...,..., ..., ... ,cast(myfunc(myparam) as varchar2(15))
> > > > mycol, ... from ... where ...;
>
> > > Brilliant! Thanks, David.
>
> > You could also use substr , as in create or replace view ..
> > as ....select ....substr(param,1,15) as param ... from ...
>
> > -Madhu Sreeram
>
> The string is already no longer than 15 characters, and that doesn't
> change the column definition in the view, which is what the OP
> originally asked. Please read the post again.
>
> David Fitzjarrell
May be I was not clear. If you describe the view, with the use of substr, it would show up as a column of varchar2(15), instead of 2000. I think that's what the OP wanted. Oracle interprets the substr to set the precision of the varchar2.
-Madhu Sreeram Received on Thu Oct 04 2007 - 17:15:45 CDT
![]() |
![]() |