Request SID with NLS params

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Request SID with NLS params

Post by sinys » Sat 02 May 2015 10:17

After connect ODAC send request NLS params.
Could you please add feature at the same time with NLS params request SID?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Request SID with NLS params

Post by AlexP » Tue 05 May 2015 10:20

Hello,

Please clarify, what exactly do you want to retrieve: the session ID or the database system identifier?
to retrieve the session ID, you can use the following query:

Code: Select all

select sys_context('userenv','sessionid') Session_ID from dual;

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Request SID with NLS params

Post by sinys » Tue 05 May 2015 16:34

Hello!

I mean sys_context('userenv','sid'). Of course I can send this request after connect, but it is additional network round-trip request. I offer add future for request SID in your NLS request.
Smth like this:
OraSession1.RequestSIDOnConnect := true;

declare cursor NlsParamsCursor is SELECT * FROM nls_session_parameters;begin SELECT Nvl(Lengthb(Chr(16777216)), Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1))), Nvl(Lengthb(Chr(1)), 1) INTO :MaxCharLength, :MinCharLength FROM dual; for NlsRecord in NlsParamsCursor loop if NlsRecord.parameter = 'NLS_DATE_LANGUAGE' then :NlsDateLanguage := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_DATE_FORMAT' then :NlsDateFormat := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_NUMERIC_CHARACTERS' then :NlsNumericCharacters := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_TIMESTAMP_FORMAT' then :NlsTimeStampFormat := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_TIMESTAMP_TZ_FORMAT' then :NlsTimeStampTZFormat := NlsRecord.value; end if; end loop;
:SID := sys_context('userenv','sid');
end;

where OraSession1.SID can return initialized SID;
of course when variable sys_context('userenv','sid') is available (oracle 10g and later).

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Request SID with NLS params

Post by AlexP » Wed 06 May 2015 07:51

SID is not related to NLS parameters. Therefore it is not quite correct to retrieve SID when retrieving these parameters.
You can leave your suggestion on our uservoice page: https://devart.uservoice.com/forums/104 ... 915-oracle . If it gets enough user votes, we will implement it.

Post Reply