Home > Back-end >  Oracle enforce SYSDATE to PT
Oracle enforce SYSDATE to PT

Time:09-16

I have a database for which I want to enforce SYSDATE to be Pacific Time. I cannot modify the date of the host for my DB due to business rules and currently SYSDATE is CDT.

I am aware that I can change the timezone for my session, however I cannot control that other users will alter their sessions as well

Is there a way I can enforce users to use PT without modifying the date of the host?

I was thinking maybe a sort of PL/SQL trigger that alters the session every time a new connection to DB is stablished.

Thanks1

CodePudding user response:

You can use an "after logon" trigger to set time zone.

Include the following sentence inside trigger:

execute immediate 'ALTER SESSION SET TIME_ZONE=''-05:00''';

Change "-05:00" with time offset of "Pacific Time"

  • Related