Monday, October 25, 2010

Oracle FIXED_DATE Parameter

FIXED_DATE enables you to set a constant date that SYSDATE will always return instead of the current date. 

To undo a fixed date setting, specify FIXED_DATE=NONE

This parameter is useful primarily for testing. 

The value can be in the format shown above or in the default Oracle date format, without a time.

Testing against a fixed date in Oracle?
Testing against a fixed date is easy in Oracle. Here is one example demonstrating use of FIXED_DATE parameter.

Assuming you wanted to set a date Jan 1, 2010 in your database.

SQL> Select sysdate from dual ;
This will display the current system date
SQL> Alter System Set Fixed_Date='01-Jan-2010' ;
SQL> Select sysdate from dual ;
This will display the system date as '01-Jan-2010'
The above Alter command can change the current sysdate to the date given.

To change the sysdate to the original date.
SQL> Alter System set fixed_date='none' ;
SQL> Select sysdate from dual ;
This will display the current system date

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home