Posted By: Norbert Klamann login.sql or similar ? - 07/17/18 01:10 PM
Hello all,
Oracle SQLDeveloper uses a login.sql which sets some session option (like NLS-settings)
Does this exist in PL/SQL_devloper too ?

I found nothing in the help

Thanks

Norbert
Posted By: Marco Kalter Re: login.sql or similar ? - 07/18/18 09:18 AM
When defining a connection in PL/SQL Developer you can enter a SQL script on the Initialization tab page that will be executed for each session that is created for this connection. Separate multiple statements with semi-colons, and terminate PL/SQL blocks with a slash.

You can additionally use the AfterConnect.sql file to specify a script that is executed for all sessions.
Posted By: Norbert Klamann Re: login.sql or similar ? - 07/19/18 09:32 AM
This does not solve my problem. I want a complete controllable display of
DATE
TIMESTAMP
TIMESTAMP_TZ
data.
I want to use the SESSION settings for this purpose, but PL/SQL Developer ignores them.
Posted By: Marco Kalter Re: login.sql or similar ? - 07/20/18 09:46 AM
By default PL/SQL Developer displays date values in the format defined in the Windows Control Panel. It does not use the Oracle format for this. To change the formats, go to Preferences > User Interface / NLS Options.

Timestamp values are displayed using the NLS_TIMESTAMP_FORMAT and NLS_TIMESTAMP_TZ_FORMAT settings of the session. You can either:
  • Use alter session statements in one of the initialization scripts as described above
  • Set registry keys for NLS_TIMESTAMP_FORMAT and NLS_TIMESTAMP_TZ_FORMAT in the Oracle registry
  • Define NLS_TIMESTAMP_FORMAT and NLS_TIMESTAMP_TZ_FORMAT environment variables
  • Specify these variables in the Params.ini file in the PL/SQL Developer installation directory. For example:

    ENV:NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS.FF6
    ENV:NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS.FF6 TZR
Posted By: Marco van der Linden Re: login.sql or similar ? - 07/23/18 12:14 PM
Isn't AfterConnect.sql what's meant here? If I recall correctly I used this in the past to set session NLS parameters.
Posted By: Klemen Re: login.sql or similar ? - 09/26/18 01:12 PM
Hi all
adding my issue in here because it's familiar.

I'm having issues with the NLS settings not being used.
I tried setting them in Settings -> NLS Options (nothing changed) and also adding the update session into AfterConnect.sql and also nothing changed...
the options above are not applicable because I'm connecting to different servers that are not handled by me.

Is there some other option? Because it's really annoying to update the session each time I switch connections...

using the version:
Version 12.0.7.1837 (64 bit)
Windows 10 Build 17134
Posted By: Marco Kalter Re: login.sql or similar ? - 09/27/18 08:48 AM
The preference settings only apply to the dates, times and numbers displayed in the PL/SQL Developer user interface. They do not affect the Oracle NLS settings of your database sessions.

The best way to define the Oracle NLS settings is through the Oracle Registry. This ensures that all tools and applications use the same settings.

Posted By: Klemen Re: login.sql or similar ? - 10/03/18 09:27 AM
What I meant with 'I'm having issues with the NLS settings not being used' is that I set the format in preferences and still when I select a date, timestamp it shows just the date without time.

The updating of the session is just a workaround to get the results that I want, temporary though..

That's why i tried also to add the update of the session in the AfterConnect.sql but without success

Regards
Klemen
© Allround Automations forums