Number and date format: changing NLS_SESSION_PARAMETER not working?

Oracle 11.2.0.3.0, APEX 4.1.1.00.23.

We need to display the numbers in our application with the format FM999999999990.000and dates with the English format DD-MON-YYYY.

Even if the application language changes (French, Spanish, etc.), we always need this format for numbers (without a space or a comma for a group separator and a period for a decimal separator, i.e. -1254.010) and date (first 3 letters from the English month, i.e. 12-FEB-2012).

Here are the globalization attributes that we use (Application Builder → Application → Change Globalization Attributes):

  • Appendix Main language: French (France) (fr)
  • Application language derived from: session
  • Application Date Format: DD-MON-YYYY

I can’t get it to work as expected ... I still get digits of type -1254,01and date similar 12-FÉVR.-2012to -1254.010and instead 12-FEB-2012. APEX seems to ignore any call to change the session ...

I tried to enter the following code in the PL / SQL Code Initialization attribute "(Application Builder -> Application -> Change Security Attributes), but without any success:

BEGIN
   EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_NUMERIC_CHARACTERS= ''.,'' ';
   EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_LANGUAGE = ''AMERICAN'' ';
   EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_LANGUAGE = ''AMERICAN'' ';
END;

I have a report with the following query to see if the parameters are changing:

SELECT
  a1.parameter as "Parameter",
  a1.value as "Database value",
  a2.value as "Instance value",
  a3.value as "Session value"
FROM
  nls_database_parameters a1
  LEFT JOIN nls_instance_parameters a2 ON a1.parameter = a2.parameter
  LEFT JOIN nls_session_parameters a3 ON a1.parameter = a3.parameter
ORDER BY
  a1.parameter asc;

Result:

report NLS parameters no changes

As you can see, challenges ALTER SESSIONdo not change anything ...

ALTER SESSION Before Header, , , ( ), ... " ", , , ...

- ALTER SESSION PL/SQL-, APEX. "/ ".

: ?


EDIT:

:

BEGIN
   APEX_UTIL.SET_SESSION_LANG('fr');
   EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_NUMERIC_CHARACTERS= ''.,'' ';
   EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_LANGUAGE = ''AMERICAN'' ';
END;

, :

report NLS parameters

  • .
  • , NLS.
  • , .
  • "SQL Query" .
  • Number "SQL Query" .
  • , JQuery, , PL/SQL, htp.prn() , .
  • , JQuery, ( ..) .

, , ​​ . "" - .

"getDate", ajax, ! "" (invalid date).

- , JavaScript ( ajax- Application Demand, PL/SQL ) ?

, , , Before Header. , , "" , .

, .

+7
4

, , "" , , . , ? , , ? , : = SYSDATE. Application- > Global Settings- > Application Date Format, , , .

, APEX_PUBLIC_USER, . , DBA , .

, , Apex ( URL-) Oracle. , , , Oracle, , , , AJAX , Oracle. , "ALTER SESSION" .

, . , , !: -)

0

, , :

, " Oracle" (). , sqlldr, NLS ( ).

, :



, NLS_LANG Oracle.

NLS_LANG Oracle, NLS_LANG.

:

SELECT * FROM V$NLS_PARAMETERS

NLS_LANG, [NLS_LANGUAGE]_[NLS_TERRITORY].[NLS_CHARACTERSET].

: American_America.UTF8

Windows:

  • Control Panel > System Advanced tab. Environment Variables.
  • System variables New.
  • " " NLS_LANG.
  • " " NLS_LANG, 1 (: American_America.UTF8).

UNIX , :

setenv NLS_LANG <NLS_LANG>

:

setenv NLS_LANG American_America.UTF8.

7- 8- ASCII, Informatica Server UNIX,

NLS_LANG <NLS_LANGUAGE>_<NLS_TERRITORY>.WE8ISO8859P1

. , NLS_LANG, , .

.

0

Apex? , , NLS. Apex .

NLS, , .

NLS- Apex ( , ). .

, .

0

apex- . , js callback.

?

The language of the Application Express session can be set using the APEX_UTIL.SET_SESSION_LANG procedure or using the P_LANG parameter of the F procedure in the URL.

You can also try putting the initialization code here: Security Attributes → Database Session → PL / SQL Initialization Code. But I'm not sure about callbacks.

0
source

All Articles