暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle-Sysdate&SYSTIMESTAMP

zy 2024-09-30
158

1.SYSDATE

SYSDATE returns the current date and time set for the operating system on which the database server resides. The data type of the returned value is DATE, and the format returned depends on the value of the NLS_DATE_FORMAT initialization parameter. The function requires no
arguments. In distributed SQL statements, this function returns the date and time set for the operating system of your local database. You cannot use this function in the condition of a CHECK constraint.

In a multitenant setup existing PDBs and PDBs created later inherit the timezone of the system. If you want SYSDATE to return the timezone of the PDB, then you must set the initialization parameter TIME_AT_DBTIMEZONE to TRUE before starting the PDB.
You can change the timezone using ALTER SYSTEM SET TIME_ZONE or ALTER DATABASE db_name SET TIME_ZONE. You can set SYSTIMESTAMP to return system time by setting the initialization parameter TIME_AT_DBTIMEZONE to FALSE and restarting the database.

  1. SYSTIMESTAMP

SYSTIMESTAMP returns the system date, including fractional seconds and time zone, of the system on which the database resides. The return type is TIMESTAMP WITH TIME ZONE.

In a multitenant setup existing PDBs and PDBs created later inherit the timezone of the system.

If you want SYSTIMESTAMP to return the timezone of the PDB, then you must set the initialization parameter TIME_AT_DBTIMEZONE to TRUE before starting the PDB.

You can change the timezone using ALTER SYSTEM SET TIME_ZONE or ALTER DATABASE db_name SET TIME_ZONE.

You can set SYSTIMESTAMP to return system time by setting the initialization parameter TIME_AT_DBTIMEZONE to FALSE and restarting the database.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论