3 Replies Latest reply: Jul 23, 2011 5:12 AM by jariola RSS

    Set APEX application item using PL/SQL

    DejanL
      Is it possible to set APEX application item value using PL/SQL?

      Thanks
      DejanL
        • 1. Re: Set APEX application item using PL/SQL
          jariola
          Hi,

          Yes, in application or page process like
          :MY_APP_ITEM := 'Hello';
          Or from database procedure using APEX_UTIL.SET_SESSION_STATE
          http://download.oracle.com/docs/cd/E17556_01/doc/apirefs.40/e15519/apex_util.htm#CHDBGEEC

          Regards,
          Jari
          • 2. Re: Set APEX application item using PL/SQL
            DejanL
            Hi,
            this works fine when you set this value in APEX apllication.
            My situation is little different.
            I have first table with field CREATED_BY. This field is populated through trigger:
            :NEW.CREATED_BY := v('F_USER');
            Everything is OK when you add record through APEX application.
            Now, I need to add record in first table through trigger of second table.
            In second table only way to add record is from Oracle Forms.
            In this situation trigger doesn't see F_USER APEX application item and field CREATED_BY
            is empty.

            Any idea,
            Thanks
            • 3. Re: Set APEX application item using PL/SQL
              jariola
              Hi,

              Well, you need have valid Apex session order to set session state for item.
              How about change trigger as below.
              :NEW.CREATED_BY := NVL(v('F_USER'),USER);
              Regards,
              Jari