Fixed sysdate to specific value with FIXED_DATE in Oracle

Fixed sysdate value to particular date for testing in Oracle

FIXED_DATE parameter is make the date value constant for the SYSDATE function. Default setting is NONE. This parameter is specific used for testing data for specific value without alter code which use SYSDATE function.

Change the SYSDATE with FIXED_DATE Function

SQL> select sysdate from dual;

SYSDATE
---------
21-MAY-21

SQL> ALTER SYSTEM SET FIXED_DATE='2021-01-01 12:00:00';

System altered.

SQL> select sysdate from dual;

SYSDATE
---------
01-JAN-21

Rollback the SYSDATE functionality by Setting FIXED_DATE = NONE

SQL> ALTER SYSTEM SET FIXED_DATE=NONE;

System altered.

SQL> select sysdate from dual;

SYSDATE
---------
21-MAY-21

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.