Solved

Oracle Session Set Time

Posted on 2013-06-28
5
726 Views
Last Modified: 2013-06-28
Dear Experts,

There is a way to set the timezone for session by using - alter session set time_zone = '+02:00'

Is there a way to set the date&time for session?  The result would be that a "select sysdate from dual" would yield a value relative to the the date&time set.

The end result is that I want to set the date&time to JAN15 and run a test based on that time.  I am not able to change the server time because it will impact others using the server.

Thanks,

Bill
0
Comment
Question by:bilpar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39284712
You cannot rewire sysdate.  It makes a hard call to the OS.

The one exception at the database level is FIXED_DATE:
http://docs.oracle.com/cd/E11882_01/server.112/e25513/initparams093.htm#REFRN10062

This will leave the servers date alone but everything in the database will think it is that date.
0
 

Author Comment

by:bilpar
ID: 39284776
Hi slightwv,

This is so very close to what I need... But, it acts at the SYSTEM level and impacts everyone on the database.  I am looking for something that acts at the SESSION level.

Thanks very much.  I did learn something new.
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39284890
I don't know of a way to have the session alter a call to sysdate.

I did see where someone wrote their own function mysysdate that returned a specific value but you would need to change all your calls from sysdate to mysysdate.

Can you not create a new 'test' database for this testing?  Then you can set it to whatever you want.
0
 

Author Comment

by:bilpar
ID: 39285011
Hi slightwv,

I am doing some work for a large company.  It takes a long time to set things up.  Lots of paperwork.  We know the code works today (with day light savings turned on).  But, we dont know for sure what will happen in November (after day light savings is turned off).

I was looking for a way to test TIMESTAMP with LOCAL ZIME ZONE columns.  If we cannot do that then we will GO LIVE in 2 weeks.  In the meantime, we will setup the dedicated test server and change the date and the test to make sure the code works... prior to the November of course.

Thanks for you assist,

Bill
0
 

Author Closing Comment

by:bilpar
ID: 39285013
Hi slightwv,

I am doing some work for a large company.  It takes a long time to set things up.  Lots of paperwork.  We know the code works today (with day light savings turned on).  But, we dont know for sure what will happen in November (after day light savings is turned off).

I was looking for a way to test TIMESTAMP with LOCAL ZIME ZONE columns now.  If we cannot do that then we will GO LIVE in 2 weeks.  In the meantime, we will setup the dedicated test server and change the date and the test to make sure the code works... prior to the November of course.

Thanks for you assist,

Bill
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question