Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can I use Aggregate Functions and convertion function togather?
Originally posted by Carfield Yim
> Hi, I've a column which the datatype is varchar, but all data store
> there is real number (I know that this is schema design problem, but I
> can't change that)
>
> Now I need to select the average of all record of that column, group
> by some other criteria, I would like to know can I use convertion
> function inside an aggregate function? Is this operation portable?
>
Why didn't you just try it? Yes you can:
SQL> select max(to_char(sal)) from emp;
MAX(TO_CHAR(SAL))
(I converted NUMBER to VARCHAR2 rather than other way because that's what I had to hand).
Portable? You mean to SQL Server etc.? In that case you should use ANSI SQL:
SQL> select max(cast(sal as varchar2(10))) from emp;
MAX(CAST(S
-- Posted via http://dbforums.comReceived on Fri Jul 04 2003 - 07:40:19 CDT
![]() |
![]() |