Package UC_FROALA_SAMPLE_CLEANUP
The package removes sample data left behind by Oracle APEX sessions that have ended. It is used by the plug-in sample application and was introduced in release 26.1.0.
The sample application writes demonstration data into UC_FROALA_SAMPLE_BLOBS and UC_FROALA_SAMPLE_CLOBS. Those are ordinary tables, so the rows outlive the session that created them and nothing removed them.
The package lives on its own rather than in UC_FROALA_SAMPLE_APP because
that package reads the CGI environment when it is first referenced, which is not available outside
a web request. UC_FROALA_SAMPLE_CLEANUP touches neither the CGI environment nor session state, so
it can be called from a scheduler job, from SQL*Plus, or from inside Oracle APEX.
Installing the sample application does not create a scheduler job. The procedure is there for instances where the sample application is hosted and sessions accumulate; call it however suits your environment.
Procedures
The package exposes the following procedure:
remove_data_for_old_sessions
Deletes sample rows that are older than p_retention_days and whose Oracle APEX session no
longer exists.
procedure remove_data_for_old_sessions(
p_retention_days in number default 8
);
| Parameter | Data Type | Default | Description |
|---|---|---|---|
p_retention_days | NUMBER | 8 | Rows older than this many days become eligible |
Both conditions are required. The sample application creates its demonstration data when a session starts, so a row's age tracks its session's age. Age alone would delete the data of a user whose session outlives the retention period while they are still working.
The default of 8 days deliberately exceeds Oracle APEX's default maximum session length
(MAX_SESSION_LENGTH_SEC, 604800 seconds = 7 days). Raise it if your instance allows longer
sessions.
The procedure takes no action at all when no Oracle APEX sessions are visible to it, so that a context in which it cannot see live sessions can never be mistaken for "every session has ended".
Example
begin
UC_FROALA_SAMPLE_CLEANUP.remove_data_for_old_sessions( p_retention_days => 8 );
end;
/