dcrespo wrote:
>
> SELECT
> CASE WHEN is_odd(t.number) THEN 'Update' ELSE 'Insert' END AS
> action,
> CASE WHEN is_odd(t.number) THEN t.number ELSE NULL END AS number,
> FROM ... ;
>
> As you can see, is_odd function (only a function example) is being run
> twice with exactly the same parameters to put a value into action
> field and into number field. Since it's the same function call, I want
> it to be run only once and put the above values into their
> corresponding fields. My actual function is not that expensive, but
> has to be run for every retrieved row, obviously. Does this change
> your explanation?
If your objective is to run a stored procedure once but return several
values, look at either defining multiple OUT parameters, or returning a
record type.
--
Guy Rouillier