4 Replies Latest reply: Feb 11, 2013 7:22 AM by AlexAnd RSS

    fnd_global.APPS_INITIALIZE  and sys_context('USERENV','LANG')

    876162
      Hi friends
      I am trying to simulate oebs connection using toad /sql plus
      But even though session language for user is not english in OEBS its giving me result as US
      Following is code that I am using

      DECLARE
      L_LANG VARCHAR2(100);
      L_LANG1 VARCHAR2(100);
      BEGIN
      fnd_global.APPS_INITIALIZE(user_id=>'106987',
      resp_id=>'50296',
      resp_appl_id=>'20003');

      select sys_context('USERENV','LANG')
      INTO L_LANG FROM DUAL;

      dbms_output.put_line(L_LANG);


      SELECT sys_context('USERENV','LANGUAGE')
      INTO L_LANG1
      FROM DUAL;
      dbms_output.put_line(L_LANG1);
      END;


      Output :
      US
      AMERICAN_AMERICA.UTF8

      However when I checking language from diagnostics language is not english
      In OEBS Help > Diagnostics >Examine

      Block : SELECT
      Field : sys_context('USERENV','LANG')
      Value : N

      Block : SELECT
      Field : sys_context('USERENV','LANG')
      Value : NORWEGIAN_NORWAY.UTF8

      Can you tell me why in toad its not giving me output as N and NORWEGIAN_NORWAY.UTF8

      Regards
        • 1. Re: fnd_global.APPS_INITIALIZE  and sys_context('USERENV','LANG')
          876162
          Hi
          Please some one reply to this.I have already searched in this externsively but didnt get answer

          Thanks
          • 2. Re: fnd_global.APPS_INITIALIZE  and sys_context('USERENV','LANG')
            AlexAnd
            >
            select sys_context('USERENV','LANG')
            INTO L_LANG FROM DUAL;
            >
            it's for toad

            >
            However when I checking language from diagnostics language is not english
            In OEBS Help > Diagnostics >Examine

            Block : SELECT
            Field : sys_context('USERENV','LANG')
            Value : N

            Block : SELECT
            Field : sys_context('USERENV','LANG')
            Value : NORWEGIAN_NORWAY.UTF8
            >
            it's for ebs


            >
            Can you tell me why in toad its not giving me output as N and NORWEGIAN_NORWAY.UTF8
            >
            because toad session is in AMERICAN_AMERICA.UTF8 and ebs session is in NORWEGIAN_NORWAY.UTF8

            if you want to have NORWEGIAN_NORWAY.UTF8 in toad then alter your session
            as example for russian
            SQL> select sys_context('USERENV','LANG') from dual;
             
            SYS_CONTEXT('USERENV','LANG')
            --------------------------------------------------------------------------------
            US
             
            SQL> select sys_context('USERENV','LANGUAGE') from dual;
             
            SYS_CONTEXT('USERENV','LANGUAG
            --------------------------------------------------------------------------------
            AMERICAN_CIS.CL8MSWIN1251
             
            SQL> alter session set nls_language = 'RUSSIAN'
              2  /
             
            Session altered
             
            SQL> select sys_context('USERENV','LANG') from dual;
             
            SYS_CONTEXT('USERENV','LANG')
            --------------------------------------------------------------------------------
            RU
             
            SQL> select sys_context('USERENV','LANGUAGE') from dual;
             
            SYS_CONTEXT('USERENV','LANGUAG
            --------------------------------------------------------------------------------
            RUSSIAN_CIS.CL8MSWIN1251
             
            SQL> 
            • 3. Re: fnd_global.APPS_INITIALIZE  and sys_context('USERENV','LANG')
              876162
              AlexAnd wrote:
              >
              select sys_context('USERENV','LANG')
              INTO L_LANG FROM DUAL;
              >
              it's for toad
              Yes true it is .. but I was of opinion that using

              fnd_global.APPS_INITIALIZE(user_id=>'106987', resp_id=>'50296', resp_appl_id=>'20003');

              will make sure that session language will be set to same as of set by user(106987) in preferences page( which happens when user logins to ebs and hence ebs language is Norwegian), so by this way a programmer would have been able to completely simulate ebs using plsql.. but I guess I was wrong..

              Thanks for your reply :)
              • 4. Re: fnd_global.APPS_INITIALIZE  and sys_context('USERENV','LANG')
                AlexAnd
                >
                so by this way a programmer would have been able to completely simulate ebs using plsql..
                >
                why?

                use
                fnd_global.apps_initialize and mo_global.init
                that's all

                look at the code of fnd_global.
                fnd_global.apps_initialize has set_nls procedure which use dbms_session.set_nls for setting nls by related to global settings (if i'm not wrong :)

                SQL Queries and Multi-Org Architecture in Release 12 [ID 462383.1]