ApEx: Setting session state from within a PL/SQL Package/Procedure/Function
Within ApEx PL/SQL Processes, regions and items you can use the bind variable syntax (:PX_MY_ITEM
) both to read and set the value of that item held in session state. Like so:
:PX_MY_ITEM := 'wibble';
l_my_local_variable := :PX_MY_ITEM;
However, in stored PL/SQL packages, procedures and functions you cannot use the bind variable syntax. Rather, you must use the v('PX_MY_ITEM')
syntax. But this is read only.
So how do you set the value held in session state for a given page item from within a stored package, procedure or function?
The answer lies in the set_session_state
procedure found in the APEX_UTIL
package. E.g.
APEX_UTIL.set_session_state(
p_name => 'PX_MY_ITEM'
, p_value => 'wibble');
Categories: ApEx
http://expert-statement.blogspot.com/2011/01/dynamically-getting-and-setting-apex.html?spref=bl
This link details the step to dynamically get and set session values in oracle apex 4.0
you say> The answer lies in the set_sesssion_state procedure…
i say> Too many “ssssss” in set_session_state.
If someone uses Google, they may miss this excellent post!
:-(
Margaret,
The best place to post questions is on the ApEx forum which can be found at:
http://forums.oracle.com/forums/forum.jspa?forumID=137
This exposes your question to the widest possible audience and you will almost always get a very speedy, accurate and helpful reply.
Thanks,
Andy
I am new with ApEx, VERY new. :o)
I am trying to figure out how to change the value of an item (column) in the database from a PL/SQL process or javascript function. I read this article and then looked up session state. From what I understand the session state will allow the change of the value of an item but the session state is cleared regularly. How does this changed value of an item get to the database?
“The session state process is used to modify values in the session state for applications, pages, or page items.”, I read in Easy Oracle HTML-DB, page 298. But, I’m not finding how to change the value in the database to be the same as what one might set the session state to. Help???? Thank you, M