0% found this document useful (0 votes)
49 views10 pages

Roel Hartman - Enemy of The Session State - Compressed

This document discusses several techniques for managing session state and context in Oracle Application Express (APEX) applications, including using packages, views with bind variables, and Oracle Database contexts. It also introduces the concept of temporal validity in APEX using Oracle Flashback Data Archive to query data as it existed at a previous point in time.

Uploaded by

Florin Nedelcu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views10 pages

Roel Hartman - Enemy of The Session State - Compressed

This document discusses several techniques for managing session state and context in Oracle Application Express (APEX) applications, including using packages, views with bind variables, and Oracle Database contexts. It also introduces the concept of temporal validity in APEX using Oracle Flashback Data Archive to query data as it existed at a previous point in time.

Uploaded by

Florin Nedelcu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Back inin the

Back the old


old days…
days…

15 Mb
per user
1,000 users

=> 15 Gb

In modern times…

15 Mb
per connection
1,000 users

=> 10 - 100 connections

=> 150 - 1500 Mb

session state
save everything you need again in
session state

in PL/SQL use binds or


apex_util.set_session_state -
don’t mix

“memory only” saves resources


create or replace package ess_demo


as
g_global_value varchar2(100);
procedure set_global_value( p_value in varchar2 );
function get_global_value return varchar2;
end;
/

create or replace package body ess_demo


as

es
procedure set_global_value( p_value in varchar2 )

r ia bl is

Va
begin

k a g e g_global_value := p_value;

Pac
end set_global_value;

function get_global_value return varchar2


is
begin
return g_global_value;
end get_global_value;
end;
/

exec ess_demo.set_global_value('I LOVE APEX');

select ess_demo.get_global_value from dual;

GET_GLOBAL_VALUE
------------------------------
I LOVE APEX

create or replace view my_emp create or replace context my_apex_context using context_api
as /
select * from emp where deptno = nv('P4_DEPTNO')
/ create or replace package context_api as
procedure set( p_name in varchar2, p_value in varchar2 );
end context_api;
/

create or replace package body context_api is


procedure set( p_name in varchar2, p_value in varchar2 )
is
begin
dbms_session.set_context('my_apex_context', p_name, p_value);
end set;

end context_api;
/

exec context_api.set( 'variable1', 'I LOVE APEX' ); create or replace view my_emp2
as
select sys_context('my_apex_context','variable1') from dual; select * from emp
where deptno = to_number( sys_context('my_apex_context','deptno') )
/

CONTEXT_VALUE
------------------------------
I LOVE APEX

Introducing … Temporal Validity


?
alter table eba_demo_chart_tasks
add period for eba_tasks_period (start_date, end_date)
/

select *
from eba_demo_chart_tasks
as of period for eba_tasks_period sysdate
/
dbms_flashback_archive.enable_at_valid_time function transportcosts_matrix (p_carrier_id in number
,p_country_id in number
( level => 'ASOF' ,p_transport_method in varchar2
, query_time => SYSTIMESTAMP )
); return varchar2 sql_macro

select *
from eba_demo_chart_tasks
/

sys.dbms_flashback_archive.enable_at_valid_time sys.dbms_flashback_archive.enable_at_valid_time
(level => 'ASOF' (level => 'ASOF'
,query_time => to_timestamp (:P196_CHECK_DATE ,query_time => to_timestamp (:P196_CHECK_DATE
,:APP_NLS_TIMESTAMP_FORMAT) ,:APP_NLS_TIMESTAMP_FORMAT)
); );

sys.dbms_flashback_archive.disable_asof_valid_time; sys.dbms_flashback_archive.disable_asof_valid_time;

Q&A
@RoelH
roel@apexconsulting.nl

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy