Am Dienstag, 25. Juli 2006 17:56 schrieben Sie:
> You could use a procedural language like plpgsql.
Ok, using the plpgsql approach I tried this:
CREATE FUNCTION my_function(int4) RETURNS SETOF int8 AS
$BODY$
DECLARE
myrow RECORD;
BEGIN
IF (some_condition) THEN
FOR myrow IN SEL
Am Dienstag, 25. Juli 2006 00:01 schrieb Stephan Szabo:
> The above basically looks like:
> CASE WHEN THEN ELSE
> END.
>
> In SQL92 at least, the form of which looks like (SELECT
> ...) is which is limited to 1 column and 1 row. The
> other subquery forms don't look legal in that position unl
HI!
Consider the following server side function:
CREATE FUNCTION my_function(int4) RETURNS SETOF int8 AS
$BODY$
SELECT
CASE WHEN (some_condition)
THEN (
SELECT ... -- arbitrary select (returning row(s) of int8 values)
)
ELSE (
SELECT ... -- arbitrary select (retur