2009-06-24

change sysdate

environment: Oracle 10.2

To change sysdate for testing purposes in one database,
create new scheduler job with e.g. 1 minute interval.

Following example code has +7 days offset.
Parameter fixed_date changes only sysdate, it doesn't change systimestamp.

begin
EXECUTE IMMEDIATE ( 'alter system set fixed_date='
|| ''''
|| to_char(systimestamp+7,'YYYY-MM-DD-HH24:MI:SS')
|| '''');
end;

1 comment:

  1. This seems quite easy and cake walk.Can you please post some more stuff like this. Thanks a lot.

    ReplyDelete