oracle-databasedb2sysdate

Is SYSDATE officially supported on db2?


It appears that SYSDATE (as in Oracle) works on Db2 even with non-Oracle compliant setting - default, DB2_COMPATIBILITY_VECTOR is not set to ORA.

Only kind of official info I could find is on:https://www.ibm.com/support/pages/node/236545

From DB2 9.7 onwards, SYSDATE has been marked as a keyword which is a special register as synonym for CURRENT TIMESTAMP(0) or CURRENT_TIMESTAMP(0).‚

Background of the question: need my scripts to work both on Oracle and Db2.

Do I need Db2 flavored scripts or can just use SYSDATE for both?

Is there a link to official documentation of the fact?

EDIT: As per comment from @data_henrik

I agree that documentation states

SYSDATE can also be specified as a synonym for CURRENT TIMESTAMP(0).

But this is just CAN. It does not state it IS.

EDIT 2:

It seems I was reading documentation wrong. Thanks @data_henrik.


Solution

  • See here the documentation on CURRENT TIMESTAMP in Db2. It states:

    SYSDATE can also be specified as a synonym for CURRENT TIMESTAMP(0).

    It is part of the official Db2 documentation and it has been in there for many releases. You can find it using "search"... ;-).