Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Computing truncated mean
John K. Hinsdale wrote:
> On Feb 6, 4:40 pm, Walt <walt_askier_at_SHOESyahoo.com> wrote:
>> A truncated mean or a trimmed average is the average after throwing away >> the top and bottom n percent. >> >> I seem to recall a built-in function in Oracle that did this fairly >> simply, but I can't seem to locate it in the docs. I could cook up my >> own in PL-SQL, but if there's something already out there I'd prefer to >> use it. Anybody know a simple way to do it?
Thanks. This looks pretty good, although in the dim recesses of my memory I seem to recall a function call something like "avg_trim(salary,.10,.90)" that just did this. Maybe I'm misremembering - it would have been seven years ago, probably on Oracle 7.
BTW, I think you want to include a non-null clause in your total_count query, otherwise you're including null rows in the denominator when you calculate row_frac.
//Walt Received on Wed Feb 07 2007 - 09:32:50 CST
![]() |
![]() |