Subject | Re: [firebird-support] There is a way to format datetime directly in SQL ? |
---|---|
Author | Michael Ludwig |
Post date | 2012-05-17T10:29:13Z |
Matthias Hanft schrieb am 17.05.2012 um 12:14 (+0200):
It should be noted that CURRENT_TIMESTAMP returns the timestamp of
statement start, which means it is constant during the statement
execution. […] The reason behind all this is that statements should
be atomic, so CURRENT_DATE and CURRENT_TIMESTAMP provide consistency.
If statement execution takes a long time it can easily happen that
the date changes between statement start and end.
http://www.firebirdfaq.org/faq114/
Michael
> Huan Ruan wrote:It is:
> >
> > select
> > extract(year from current_date) || '-' ||
> > lpad(extract(month from current_date), 2, '0') || '-' ||
> > extract(day from current_date)
> > from rdb$database
>
> Is this an "atomic" operation?
It should be noted that CURRENT_TIMESTAMP returns the timestamp of
statement start, which means it is constant during the statement
execution. […] The reason behind all this is that statements should
be atomic, so CURRENT_DATE and CURRENT_TIMESTAMP provide consistency.
If statement execution takes a long time it can easily happen that
the date changes between statement start and end.
http://www.firebirdfaq.org/faq114/
Michael