Subject Re: Making evaluation of UDFs constant across a query
Author karolbieniaszewski
--- In firebird-support@yahoogroups.com, Mike Pomraning <mjp@...> wrote:
>
> On Sat, Mar 19, 2011 at 12:47 PM, homerjones1941 <homer@...>wrote:
>
> >
> > > Is there a technique to make the return value of a UDF constant across
> > > the execution of a single query?
> > >
> > > For example, I'd like getExactTimestamp() -- or, rather, a UDF very
> > > much like it -- to return the same result every time it is evaluated...
> >
> > Can you declare a variable, and then just assign the value once?
> >
>
> In a stored procedure, yes. IMHO this is suitable for regular, production
> environments, when you already know all the queries you want to run.
> However, I find it too restrictive for general or "on the fly" querying.
>
> Another possibility is using a table or GTT or RDB$SET_CONTEXT() to store
> the precomputed value. In this case you'd have to explicitly compute the
> value before every SELECT, which is still cumbersome but more flexible IMHO
> than using a stored procedure.
>
> But, I'm wondering if there is an easier technique than any of the above.
>
> -Mike
>
>
> [Non-text portions of this message have been removed]
>

Yes exists "better" way
What problem with this i suppose that you write some client application?


Select "your_date_time_utc", x, y, z from table_x ..

Karol Bieniaszewski