Print Thread
login.sql or similar ?
#58158 07/17/18 01:10 PM
Joined: Mar 2012
Posts: 5
N
Member
OP Offline
Member
N
Joined: Mar 2012
Posts: 5
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

Re: login.sql or similar ?
Norbert Klamann #58162 07/18/18 09:18 AM
Joined: Aug 1999
Posts: 22,214
Member
Offline
Member
Joined: Aug 1999
Posts: 22,214
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.


Marco Kalter
Allround Automations
Re: login.sql or similar ?
Marco Kalter #58167 07/19/18 09:32 AM
Joined: Mar 2012
Posts: 5
N
Member
OP Offline
Member
N
Joined: Mar 2012
Posts: 5
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.

Re: login.sql or similar ?
Norbert Klamann #58168 07/20/18 09:46 AM
Joined: Aug 1999
Posts: 22,214
Member
Offline
Member
Joined: Aug 1999
Posts: 22,214
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


Marco Kalter
Allround Automations
Re: login.sql or similar ?
Marco Kalter #58169 07/23/18 12:14 PM
Joined: Jul 2004
Posts: 281
The Netherlands
Member
Offline
Member
Joined: Jul 2004
Posts: 281
The Netherlands
Isn't AfterConnect.sql what's meant here? If I recall correctly I used this in the past to set session NLS parameters.


Been there, done that, Got the T-Shirt
Re: login.sql or similar ?
Marco van der Linden #58374 09/26/18 01:12 PM
Joined: Sep 2018
Posts: 2
K
Member
Offline
Member
K
Joined: Sep 2018
Posts: 2
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

Last edited by Klemen; 09/26/18 01:49 PM. Reason: added version
Re: login.sql or similar ?
Klemen #58383 09/27/18 08:48 AM
Joined: Aug 1999
Posts: 22,214
Member
Offline
Member
Joined: Aug 1999
Posts: 22,214
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.



Marco Kalter
Allround Automations
Re: login.sql or similar ?
Marco Kalter #58393 10/03/18 09:27 AM
Joined: Sep 2018
Posts: 2
K
Member
Offline
Member
K
Joined: Sep 2018
Posts: 2
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


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.028s Queries: 15 (0.007s) Memory: 2.5274 MB (Peak: 3.0395 MB) Data Comp: Off Server Time: 2024-05-10 00:31:06 UTC
Valid HTML 5 and Valid CSS