Database Reference
In-Depth Information
Currently this region is a standard HTML region, emitting exactly the
HTML code you enter into it. You want to make it dynamic, so switch it to
use PL/SQL:
3.
In the
Identification
section, change
Type
to
PL/SQL (anonymous
block)
, as shown in
Figure 8-35
.
Figure 8-35.
Creating a PL/SQL region
4.
Enter the following code for the
Region Source
, replacing the static HTML
that was there, and then click
Apply Changes
:
DECLARE
l_count NUMBER;
l_status_id NUMBER := get_status('OPEN');
BEGIN
IF :APP_USER != 'nobody' THEN
SELECT count(*)
INTO l_count
FROM tickets
WHERE assigned_to = :APP_USER
AND status_id = l_status_id;
htp.p('<h1>Welcome to the APEX Issue Tracking
System, '
|| :APP_USER || '</h1>'
|| 'You have ' || l_count || ' Open
tickets.<br />'
|| 'Select an option from the list');
ELSE
htp.p('<h1>Welcome to the APEX Issue
Tracking System</h1>'
|| 'Select an option from the list');