Controlling SYSDATEJuly 9, 2012 at 10:29 am | Posted in Oracle Developement, PL/SQL | Leave a comment
Tags: oracle, pl/sql, plsql, sysdate
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.
Thanks to Carsten Czarski for the tip.