Change sysdate and keep the clock ticking

Hi All
We wanted to test some reports which gets processed (there are other date based calculations while processing) monthly, quarterly etc and for that we wanted the sysdate to get changed to a particular date and then the clock should go ticking.
Is there any other way other than changing the OS date. Because of organizational issues we cannot change OS dates. We tried the FIXED_DATE, but the clock is not ticking after that.
Please help
Thanks in Advance
-Georgey

Hi, Georgey,
Georgey wrote:
Hi All
We wanted to test some reports which gets processed (there are other date based calculations while processing) monthly, quarterly etc and for that we wanted the sysdate to get changed to a particular date and then the clock should go ticking. SYSDATE is taken from the operating system. If you reset the date on the database server's OS, Oracle will use the new date. Of course, anything else that runs on the database server will use the new date, too.
Is there any other way other than changing the OS date. Because of organizational issues we cannot change OS dates. We tried the FIXED_DATE, but the clock is not ticking after that. Good try, but, unfortunately, that doesn't work.
You might replace all references to SYSDATE in your code with references to a user-defined function, that returns SYSDATE plus (or minus) a constant. That will make your code slower, but that might not be an issue for testing. That probably will be n issue in Production, however, so change all the references to your user-defined function back to SYSDATE before moving the code to production.
Edited by: Frank Kulash on Sep 27, 2012 12:49 PM
Here's an example of the user-defined function:
CREATE OR REPLACE FUNCTION my_sysdate
(  in_dt  IN DATE  DEFAULT DATE '2013-01-01'
RETURN DATE
AS
--     my_sysdate returns the actual date and time (as returned by SYSDATE),
--     asif today started on in_dt.  For example, if it is actually 12:00
--     noon on September 27, 2012, then
--     my_sysdate               returns 12:00 noon on January 1, 2013
--     my_sysdate (DATE '2012-09-01')     returns 12:00 noon on September 1, 2012
--     my_sysdate ( DATE '2012-09-01'
--             + (2/24)
--             )     returns 2:00 PM on September 1, 2012
BEGIN
     RETURN  SYSDATE - ( TRUNC (SYSDATE)
                 - in_dt
END;
/If you use SQL*Plus, you can define a substitution variable at the beginning of each sript, that tells whether you want to use the real SYSDATE or your user_defined fucntion.
For example:
-- Only the last of these next 2 statemnts has any effect:
DEFINE     sysdate_function = SYSDATE
DEFINE     sysdate_function = "my_sysdate (DATE '2012-10-01')"
SELECT     CASE
         WHEN  order_date > &sysdate_fucntion
         THEN  'Future'
         WHEN  order_date > &sysdate_fucntion - 7
         THEN  'This week'
         WHEN  order_date > ADD_MONTHS (&sysdate_fucntion, -1)
         THEN  ...
     END        AS order_date_grp
...When you're ready to move this to Production, just change the DEFINE statement at the beginning. No matter how many times &sysdate_function is referenced in the script, the specified function will be called. This will not hurt performance, because, when the code is compiled, it will be compiled with the actual (fast) SYSDATE when that is what you want.

Similar Messages

  • Face time no longer works for me. Lost my contacts even! Keep trying to change PWD and keep getting same error message: The server encountered an error processing registration. Please try again later. Can you advise? Thanks!

    Face time no longer works for me. Lost my contacts even! Keep trying to change PWD and keep getting same error message: The server encountered an error processing registration. Please try again later. Can you advise? Thanks!

    Face time no longer works for me. Lost my contacts even! Keep trying to change PWD and keep getting same error message: The server encountered an error processing registration. Please try again later. Can you advise? Thanks!

  • How can I change the Apple Store language and keep the country of residence?

    How can I change the Apple Store language and keep the country of residence?

    Users do not have control over the language of the Mac App Store or iTunes stores for a particular country or region. It is what it is and can't be changed.

  • Hi, I recently changed my username for my iTunes/iCloud account. Can anyone tell me how i change the username on my iCloud iPad? When I go onto setting to change it it keeps the username grey so I can't even select it?

    Hi, I recently changed my username for my iTunes/iCloud account. Can anyone tell me how i change the username on my iCloud iPad? When I go onto setting to change it it keeps the username grey so I can't even select it?

    Welcome to the Apple Community.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")
    Providing you are simply updating your existing details and not changing to another account, when you delete your account, all the data that is synced with iCloud will also be deleted from the device (but not from iCloud), but will be synced back to your device when you login again.
    In order to change your Apple ID or password for your iCloud account on your computer, you need to sign out of the account from your computer first, then sign back in using your updated details. (System Preferences > iCloud, click the sign out button)
    In order to change your Apple ID or password for your iTunes account on your iOS device, you need to sign out from your iOS device first, then sign back in using your updated details. (Settings > iTunes & App store, scroll down and tap your ID)
    If you are using iMessages or FaceTime, you will also need to log out and into your ID there too.

  • HT4099 How to change it and keep permanent?

    I have two accounts and changing between them changes Login panel back to US Layout. I would like to keep Colemak layout all the time. How to change it and keep permanent?

    I have this problem too. Any solutions?

  • How to change country and keeping all application upgraded ? thx

    how to change country and keeping all application upgraded ? thx

    you may change the userID/ passwd from menu or create conn segment for each of the userID/ passwd combination .

  • How do I convert .txt to .pdf and keep the formatting

    I have a large .txt file that I would like to convert to .pdf.  I have tried to print the file and choose Adobe PDF but the output is just a mess.  I loose all the formatting and get blank pages every so often.  Does anyone know if is possible to convert .txt to .pdf and keep the formatting.  I would try a virtual printer application but I am not able to just install any application on my office computer.  Any help would be greatly appreciated.

    It may be a bit late for you now but in future (and for anyone else interested) I would recommend copying the text into a word document and changing the text font to Consolas. Adjust the size to fit the page again and it should match the original notepad formatting.

  • Can I replace my land line with an iPhone and keep the same phone number?  Thanks.

    Hi,  Can I replace my land line with an iPhone and keep the same AT&T phone number?  Thanks.

    Hi
    There are always some wrinkles in this kind of change.  If you have a home security system like ADT they require a land-line for their system to work.  This less of an issue in apartments and condos - it's mostly a "house" issue.
    Before you make the switch (and there may be a switching fee) just make sure you cover all the bases.
    Cheers

  • HT3215 How do you keep the clock face showing all the time without the screen going dark?

    How do you keep the clock face showing all the time without the screen going dark?

    Thanks.  I saw a number of answers to the same basic question after I posted my question and apparently there are ways to to keep it on but, as you said, it will drain the battery quickly.

  • Import clips into FCP X version 10.0.8 and keep the original clip names

    Can you Import clips into FCP X version 10.0.8 and keep the original clip names in the event original media folder? in version 10.0.8 it automatically allocates date / time of the event. I need it to keep the original clip name i:e Clip0100 event folder original media Clip0100. I am aware you can change the clip name to original once in FCP X, But it's the event folder original media name which I want to remain as the original file name.

    Hi Tom,
    Thanks for the response.
    I am aware you can do this change in the Info inspector so the original clip name from camera is used in the event library browser, but it does not change the clip name in the Final Cut Events Original Mieda file. This still remains as an event clip name "2013-05-23 17_08_13". I need the original clip name Clip0100 to remain as Clip0100 at import. FCP X doesn't seem to allow this happen any more in version 10.0.8.
    Cheers
    D..

  • I bought my wife a 5c for xmas and set it up under my itunes id. She didn't have one. Every so oftem my ID still shows up under different aps. I set her up an apple id now and want to reset everything to her ID. How do I do it and keep the apps?

    How do I switch this phone over to my Wifes new Apple ID and keep the phone lists,, apps etc that I set up? (unlocked) New

    You must first go to your Apple ID and take the device off of your listed devices and then wait until it is updated accordingly ...Next link the iPhone to her Apple ID.  go to the app store and on to 'featured' scroll down to the bottom and it shows your apple id, click it and sign out and you can then sign in with your new apple id
    If you mean your iCloud ID, go to Settings>iCloud, tap Delete Account, then sign back in with the ID you want to use.  If you are signing back into the same account, just with a renamed ID, choose Delete from My iDevice when prompted.  Your data will be synced back when you sign back in.  However, if you are changing to a new account with a new ID and need to migrate your synced data to the new account, choose Keep on My iDevice when prompted.  Then choose Merge to upload your data to the new account when you sign back in and turn on your iCloud data syncing.
    If you want to keep your photo stream photos, save them to your camera roll before deleting the account (tap Edit, tap all the photos, tap Share, tap Sae to Camera Roll).

  • Is it possible to import new slides and keep the audio?

    Hi,
    is it possible to import new slides and keep the audio?
    The designers have changed the housestyle of the powerpoints,
    but the audio has been recorded in captivate in the meanwhile. Is
    it possible to keep the audio of the files and replace all the old
    powerpoint slides with new ones? (not one by one by hand off but
    all in one button press ?)
    Thanks,
    wouter
    My
    Elearning company.

    Hi again Wouter
    Are you saying that your Library has lots of other audio that
    isn't really used on a slide? If so, try right-clicking the Library
    panel and choosing "Select Unused Items". This should highlight all
    the sound files not in use. Now press the Delete key and they
    should be removed from the Library view.
    Now you are faced with just what is left. You may not know
    which clip goes with which slide. So try this. In your Film strip,
    audio attached to the slide should appear as a Speaker icon in the
    corner. Click the Speaker icon and pop down (or up) menu should
    display. Choose "Find in Library". This should highlight the
    associated clip in the Library. Now, if you like, you may
    right-click the file in the Library and rename that to something
    like "Slide X audio" (so you know which clip goes with which
    slide).
    Cheers... Rick

  • How can I delete the video and keep the Audio  in a few frames using Imovie 11

    How can I delete the video and keep the Audio  in a few frames using Imovie 11?

    I've met the problem too before. but i solved it with  Audio Converter Mac instead of iMovie. If you have similar situation that just want to keep audio but not video, and if your file format is not workable in iMovie, you can use the Audio Converter for help too. it can easily help to extract audio soundtrack from any video format. Or if you need to convert one audio format to another, it is a good choice too, because it supports many common audio output formats.
    <Link Edited By Host>

  • I need to move 1000 photos from one library to another. How do I do that and keep the ratings and dates they were created?

    I need to move 1000 photos from one library to another. How do I do that and keep the ratings and dates they were created? I tried exporting them, but it loses all info. Also, how do I move the quicktime movies from one iphoto library to another? They were exported as jpgs

    Add both libraries to iPhoto Library Manager.  Then select the events or albums that you want to copy from library A  and drag them to library B in iPLM.
    This video shows the process:
    OT

  • Ok, so I transferred my 3S info to my 4S by restoring from an old phone backup.  But SIRI is gone and god knows what else??  Can I get my old stuff into the new phone and keep the 4S new functionality?

    ok, so I transferred my 3S info to my 4S by restoring from an old phone backup.  But SIRI is gone and god knows what else??  Can I get my old stuff into the new phone and keep the 4S new functionality?

    I suspect unless he had some items in iCloud backup then they are gone.  Connecting an iPhone to a different library from that to which it was previously connected will result in the device asking if you want to erase it.

Maybe you are looking for