The APEX HTMLDB_APPLICATION
The HTMLDB_APPLICATION package exposes several global variables used internally by the APEX engine.
-
g_user: This is the ID of the currently logged in user.
-
g_flow_id: This is the ID of the currently running application.
-
g_flow_step_id: This is the page ID for the currently running application page.
-
g_flow_owner: This is the parsing schema for the current application.
-
g_request: This is the most recent REQUEST. Requests are set by buttons in APEX.
The HTMLDB_APPLICATION package also exposes a global array which references values from certain page items. The HTMLDB_ITEM package can be used to create items on an application page. This means the developer creates them programmatically during page rendering instead of creating the page item with a wizard. When items are created like this, they are provided a numeric value. APEX then references the page item in an array. Up to 50 items can be created using the HTMLDB_ITEM package and still be allowed to reference them using HTMLDB_APPLICATION package. An example of this was provided during the checkbox explanation in an earlier chapter of this book. There, the htmldb_item.checkbox procedure was used to add checkboxes to a report. The arrays in the htmldb_application package were then used to reference the checkbox during page processing.
For the checkboxes shown in Figure 10.3, the HTML code that was rendered by using the htmldb_item.checkbox procedure looks like the following:
<input type="checkbox" name="f10" value="1" CHECKED />
<input type="checkbox" name="f10" value="2" CHECKED />
<input type="checkbox" name="f10" value="3" />
<input type="checkbox" name="f10" value="4" CHECKED />
<input type="checkbox" name="f10" value="5" />
When the page is submitted, only the checkboxes which are checked will appear in the arrays of the htmldb_application package. For the example above, there will be three array elements in the array named g_f10. Programmatically, it is possible to loop through the array in a page processing process and update the data in the database. The following code shows an example of how the code to loop through the htmldb_application.g_f10 array would look:
begin
for i in 1..htmldb_application.g_f10.count loop
update class
set available_flag = 'Y'
where class_id = htmldb_application.g_f10(i);
end loop;
end;
While looping through the array and using the sample checkboxes from above, the values one, two, and four would appear in the array.
转载自:
http://www.dba-oracle.com/t_easy_html_db_application.htm