Controlling SYSDATE

July 9, 2012 at 10:29 am | Posted in Oracle Developement, PL/SQL | Leave a comment
Tags: , , ,

For certain testing scenarios, I need to have SYSDATE return a certain date. This can be done with Oracle’s FIXED_DATE parameter.

For example, if you want SYSDATE to return ‘05-OCT-2011 15:30:00’ do the following as sys:

alter system set fixed_date = '2011-10-05 15:30:00';

If you want SYSDATE back to normal and return the correct date do:

alter system set fixed_date = none;

Note that this does not influence the behavior of SYSTIMESTAMP.

See also:

Thanks to Carsten Czarski for the tip.


Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

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

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s

Entries and comments feeds.

%d bloggers like this: