Re: user defined column functions?

From: Lennart Jonsson <lennart_at_kommunicera.umea.se>
Date: 25 Apr 2002 13:34:22 -0700
Message-ID: <6dae7e65.0204251234.48b2e13d_at_posting.google.com>


71062.1056_at_compuserve.com (--CELKO--) wrote in message news:<c0d87ec0.0204241009.6396150a_at_posting.google.com>...
> >> Are there any discussions, plans, etc. for userdefined column
> functions in future SQL versions (or do they already exist somewhere
> and I'm not looking hard enough)? <<
>
> We did add CUBE and ROLLUP to SQL-99, but you can do a lot with what
> you have now.
>

True, but I still think that it would be usefull to be able to define aggregate  functions. I would like to be able to express something like

	prod [],     acc -> acc
        |    (x::xs) acc -> prod xs x*acc 

I'm ignoring the fact that tables are unordered. Guess that can be arranged by either including a choose op which would randomly pick the first value, or by using rownumber() over (order by ...)

I find the ability to define sql functions returning tables in DB2 (probably exists for other vendors as well), very handy and it would be nice to be able to work "the other" way around as well. That is, having functions taking tables as args and returning scalars

/Lennart

[...] Received on Thu Apr 25 2002 - 22:34:22 CEST

Original text of this message