Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: median group function
This is a multi-part message in MIME format.
--------------5CF770ED78C8 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
Barry Drummond wrote:
>
> I'm looking for a median group function analogous to the Oracle group
> functions (Count, Avg, etc.) which can be used in standard SQl statments.
> As far as I can tell, PL/SQL allows only row functions to be built for use
> in SQL.
>
> *snip*
>
Barry,
The problem with the median is that it is a group function that requires analysis of a relation in a sequence. Since it is not implementable as a function, I have attached a stored procedure which can be used as a stand-alone mechanism to return the median value of an arbitrary column of an arbitrary table.
Hope this helps.
Chrysalis.
--------------5CF770ED78C8 Content-Type: multipart/appledouble; boundary="----------ad40948BCE6A"; x-mac-type="54455854"; x-mac-creator="522A6368"; name="median.sql" Content-Transfer-Encoding: 7bit Content-Description: BBEdit Lite 3.5 Document Content-Disposition: inline; filename="median.sql" ------------ad40948BCE6A
<encoded_portion_removed>
QkJTVAAAAB4D7f//AAAAAADfflgAgP//AAAATADffQg=
------------ad40948BCE6A Content-Type: text/plain; name="median.sql" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="median.sql"
<encoded_portion_removed>
Jyw6bWVkaWFuKTsNUmVtIHByaW50IG1lZGlhbjsNDQ==
------------ad40948BCE6A--
--------------5CF770ED78C8-- Received on Sat May 10 1997 - 00:00:00 CDT