Skip to Main Content

Info

This is a weird one - I've put it in the "Apex - Session State" category, but I'm not even sure that is correct...
I ran into this issue on my Search page, where sometimes the result would not be the part of the text containing the search term, but rather the start of the text.

Take a look at the two view queries below, which are identical except for a materialize hint in one of them.
In these views, I use a page item as the text to search for: "v('P1184_SEARCH_FOR') as search_for".
Turns out that the reason for the original view (which does not have the hint) to return the first part of the text, is the use of v('P1184_SEARCH_FOR') in the view query in combination with joining an Apex view - in this case apex_application_page_regions.
If I:
  change the v() function to a hardcoded string,
  OR remove the join to the Apex view,
  OR hardcode the search term in the regexp_instr functions,
  OR use a materialize hint,
it works fine.

So what's going on here? Well, I'm not sure really :-)
Maybe the Apex view switches to another session somehow, so that after the Apex view has been joined, the v('P1184_SEARCH_FOR') function then returns null (in regexp_instr)?
Something like that, maybe...
The simplest solution here was to add a materialize hint to the view. This ensures the value of "search_for" is only read once, and therefore stays the same "during" the query.

Parameters

READ ONLY

WITHOUT Hint

1120Package Body
Package Body
Name
TED_PAGE_SUMMARY
Source
package body ted_page_summary as
c_lf constant varchar2(10) := chr(13) || chr(10);
c_table_style constant varchar2(1000) :
1READ ONLY

WITH Hint

1120eader_text));
add_tr#('Footer Text', trim(c1_rec.footer_text));
end if;
-- Read Only
if p_show_read_only then
add_th#('Read Only');
add_tr#('Read Only C
18164READ ONLY

Code

Item

Identification
Sequence
Name
Display As
User Interface
Region
Source
Source Used
Source Type
Source value or expression

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

View

View
Name
DDL

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

View

View
Name
DDL