The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT row_id,
lookup_type,
item_type,
protect_level,
custom_level,
display_name,
description
FROM wf_lookup_types
WHERE item_type = c_item_type
ORDER BY display_name;
You'll notice that the select orders the
results by lookup type display name, and then
by lookup meaning. The criteria is based
on the requirement to synchronize the
lookup list with the lookup type list. The
lookup type list is ordered by display name.
When we list the lookup tyoes and their
corresponding lookups we walk these lists
in parallel. When we find a lookup that matches
the lookup type, we copy that lookup to a temp
list until we find a new lookup type in the lookup
list. When this happens we write out the lookup
temp list and move to the next lookup type.
Thus the need for the special order criteria.
PARAMETERS:
c_item_type IN Internal name of the item type
============================================================================*/
CURSOR fetch_lookups (c_item_type IN VARCHAR2) IS
SELECT
wlt.display_name lookup_type_display_name,
wlt.item_type,
wl.row_id,
wl.lookup_type,
wl.lookup_code,
wl.protect_level,
wl.custom_level,
wl.meaning,
wl.description
FROM wf_lookups wl, wf_lookup_types wlt
WHERE wlt.item_type = c_item_type
AND wlt.lookup_type = wl.lookup_type
ORDER BY wlt.display_name, wl.meaning;
SELECT
wlt.display_name lookup_type_display_name,
wlt.item_type,
wl.row_id,
wl.lookup_type,
wl.lookup_code,
wl.protect_level,
wl.custom_level,
wl.meaning,
wl.description
FROM wf_lookups wl, wf_lookup_types wlt
WHERE wlt.item_type = c_item_type
AND wlt.lookup_type = c_lookup_type
AND wlt.lookup_type = wl.lookup_type
ORDER BY wlt.display_name, wl.meaning;
SELECT row_id,
lookup_type,
item_type,
protect_level,
custom_level,
display_name,
description
INTO p_wf_lookup_types_tbl(1)
FROM wf_lookup_types
WHERE item_type = p_item_type
AND lookup_type = p_lookup_type;
SELECT MAX(display_name)
INTO l_type_display_name
FROM wf_lookup_types
WHERE lookup_type = p_type_internal_name;
SELECT MAX(meaning)
INTO l_code_display_name
FROM wf_lookups
WHERE lookup_type = p_type_internal_name
AND lookup_code = p_code_internal_name;
l_wf_lookups_tbl.delete;
l_wf_lookups_tbl.delete;