I know how the database characterset (NLS_CHARACTERSET in select * from v$nls_parameters;) and the client character set (the client environment setting NLS_LANG) interact.
What I can't find out however, is how or if I can determine, for an established session, what Oracle thinks the current client characterset is.
Is this possible at all?
Note: SELECT * FROM NLS_SESSION_PARAMETERS; does not include the character set (on 10g2).
To make absolutely clear what I'd like to accomplish:
- NLS_LANG is set in client environment to an arbitrary value (for example
GERMAN_GERMANY.WE8MSWIN1252) - Database application[*] starts and establishes a connection/session to the Oracle database.
- Database application[*] wants to "ask" Oracle (not its OS environment) what the client character set is Oracle will assume.
[*]: If the db application is sqlplus, the example would look as follows:
...
sqlplus /nolog
connect user/pass@example
*magic command*;
CLIENT CHARACTERSET = ...
Jack's note in his answer raises two important points:
- With Oracle, who does the characterset translation. Is it the client-library code or is it done on the server side?
- As it appears it is the client, the client would need expose this setting -- what the client lib/tool assumes this setting is. Is there any of the Oracle client libs/tools (sqlplus, OCI/OCCI, Pro*C, ...) that can be queried for what it thinks this setting is?