Skip to content

TRANSACTION_TIMESTAMP

功能描述

获取当前日期时间(事务开始的时间),同一个事务内,该函数返回值不变。

语法格式

TRANSACTION_TIMESTAMP()

参数说明

无参数

函数返回类型

TIMESTAMP WITH TIME ZONE

示例

sql
SQL> set auto_commit off;

Execute successful.
Use time:0 ms.     

SQL> SELECT TRANSACTION_TIMESTAMP();

EXPR1 | 
------------------------------------------------------------------------------
2024-04-03 09:21:56.000 AD +08:00 |

Total 1 records.

Use time:0 ms.     

SQL> SELECT SLEEP(2000);

EXPR1 | 
------------------------------------------------------------------------------
2000 |

Total 1 records.

Use time:2000 ms.     

SQL> SELECT TRANSACTION_TIMESTAMP();

EXPR1 | 
------------------------------------------------------------------------------
2024-04-03 09:21:56.000 AD +08:00 |