ALTER SESSION SET nls_date_format在APEX中不起作用.但是适用于SQL Developer [英] ALTER SESSION SET nls_date_format doesn't work in APEX. However works in SQL Developer
问题描述
我尝试在Oracle Application Express中使用ALTER SESSION SET nls_date_format语句更改nsl参数,但是参数保持不变.
但是在Oracle SQL Developer中,我可以对其进行更改.
我想知道为什么.
我发现此线程
I try to change nsl parametres with ALTER SESSION SET nls_date_format sentence in Oracle Application Express but parametres remain the same.
However in Oracle SQL Developer I am able to change them.
I would like understand why.
I have found this thread Number and date format : altering NLS_SESSION_PARAMETER does not work? in which Olafur Tryggvason comments something about "application settings" that override settings but I am not able to find the configuration. Should be in "Application Builder" but it is not.
IN APEX
Run
select * from nls_session_parameters;
Results
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT mm/dd/yyyy
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
Run
ALTER SESSION SET nls_date_format ="dd/mm/yyyy";
Results
Statement processed.
0.00 seconds
Run
select * from nls_session_parameters;
Results
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT mm/dd/yyyy
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
IN SQL DEVELOPER
Run
select * from nls_session_parameters;
Results
PARAMETER VALUE
NLS_LANGUAGE SPANISH
NLS_TERRITORY SPANISH
NLS_CURRENCY €
NLS_ISO_CURRENCY SPAIN
NLS_NUMERIC_CHARACTERS ,.
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT mm/dd/yyyy
NLS_DATE_LANGUAGE SPANISH
NLS_SORT SPANISH
NLS_TIME_FORMAT HH24.MI.SSXFF
NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR
NLS_DUAL_CURRENCY €
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
Run
ALTER SESSION SET nls_date_format ="dd/mm/yyyy";
Results
1 fila insertadas.
Session alterado.
Run
select * from nls_session_parameters;
Results
PARAMETER VALUE
NLS_LANGUAGE SPANISH
NLS_TERRITORY SPANISH
NLS_CURRENCY €
NLS_ISO_CURRENCY SPAIN
NLS_NUMERIC_CHARACTERS ,.
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT dd/mm/yyyy
NLS_DATE_LANGUAGE SPANISH
NLS_SORT SPANISH
NLS_TIME_FORMAT HH24.MI.SSXFF
NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR
NLS_DUAL_CURRENCY €
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
Oracle APEX uses a shared connection pool to execute queries. If you're running this in the SQL Workshop, I wouldn't think you will get a result you expect.
If you were running this as part of any given transaction, or if it appears in the Initialisation code as Littfoot suggests, you should see the format change for that session. Once control goes back to the user in the browser, the database connection is released.
This is the same reason you can't use concepts such as package persistent variables, and global temporary tables in Oracle APEX.
If you need to change the settings for your application, the recommended place is the Globalisation Attributes in Shared Components. (The third tab in Application properties.)
这篇关于ALTER SESSION SET nls_date_format在APEX中不起作用.但是适用于SQL Developer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!