I would like to have every session in my SQL Developer to be set to the GMT timezone. Is there a way to setup a session startup script in SQL Developer for this?
You can create a script file, e.g. C:\Temp\startup.sql
, containing:
alter session set time_zone = 'GMT';
Then go to the Preferences, from the Tools menu, and go to the top-level Database item in the panel on the left, and put the path to your file in 'filename for connection startup script' text box:
You can change other settings in your script as well, if they can't be set in the Preferences->Database->NLS section.
The settings are only picked up when you open a new connection - they don't seem to be reapplied when you reconnect or when you open a new SQL Worksheet under an existing connection.
When you connect the 'script output' window will say:
session SET altered.
In 4.0.1 anyway, but apparently not in 4.0.2; and if you then do something like:
select current_timestamp from dual;
then you'll see the GMT time regardless of your PC's locale settings:
CURRENT_TIMESTAMP
-----------------------------------
06-MAY-14 11.23.42.593143000 GMT
with the script, versus in my case this without:
CURRENT_TIMESTAMP
-----------------------------------
06-MAY-14 12.25.09.925466000 EUROPE
/LONDON
This is tested in version 4.0.1.14 and 4.0.2.15; I think it's always been possible but I'm not able to check previous versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With