Subject Re: Exact timestamp w/o using UDF?
Author Adam
--- In firebird-support@yahoogroups.com, Hans <hhoogstraat@...> wrote:
>
> Adam and Helen,
>
> Run this little procedure with 'Select * from TimeTest' and you'll
see what
> I mean
> with Current_Time_Stamp doesn't change during execution of a procedure.

That may be what you mean but it is not what you wrote, and both Helen
and I corrected your post.

Your confusion stems from the fact that Firebird considers each
execution of the stored procedure as a single operation. After running
the procedure as per your example, this is quite easy to test. Simply
run it twice within a single transaction.

SELECT * FROM TIMETEST;
SELECT * FROM TIMETEST;

You may need to turn of wrapping to see the results properly:
---

NOW_START NOW_END
CURRENT_TIMESTAMP_START CURRENT_TIMESTAMP_END
========================= =========================
========================= =========================

2006-10-10 08:31:40.0000 2006-10-10 08:31:46.0000 2006-10-10
08:31:40.0000 2006-10-10 08:31:40.0000


NOW_START NOW_END
CURRENT_TIMESTAMP_START CURRENT_TIMESTAMP_END
========================= =========================
========================= =========================

2006-10-10 08:31:46.0000 2006-10-10 08:31:51.0000 2006-10-10
08:31:46.0000 2006-10-10 08:31:46.0000

---

As you observed, CURRENT_TIMESTAMP_END does not change from the start
to the end of the stored procedure, but if you run the timetest
procedure twice within the *** same *** transaction, you clearly get a
different value from CURRENT_TIMESTAMP.

As I pointed out, CURRENT_TIMESTAMP *** does *** indeed change within
the context of a transaction, but is held constant for the a single
operation. A stored procedure execution is considered to be a single
operation.

Adam