APEX-AT-WORK no image

Strange behavior of "No Inline Validation Errors Displayed" check

Von Tobias Arnhold 11.19.2009
I had two conditional processing checks for one pl/sql process to do. One "No Inline Validation Errors Displayed" check and one "Exist (SQL query returns at least one row)" check.

I thought it would be quite easy to merge it together into a "Exist (SQL query returns at least one row)" condition:

select *
from user_db_links
where UPPER(db_link) = UPPER(:P1_I_INSTANCE_NAME)
and (UPPER(username) not like UPPER(:P1_USERNAME)
or UPPER(host) not like UPPER(:P1_DB_NAME)
or :P1_PASSWORD is not null)
and wwv_flow.g_inline_validation_error_cnt = 0

-- and I tried this AND clause
-- and (select wwv_flow.g_inline_validation_error_cnt from DUAL) = 0

The result was less promising. It just didn't work. The pl/sql process never run with wwv_flow.g_inline_validation_error_cnt in it.

My workaround was to add a new item called :P1_ERROR. I wrote the amount of validation errors into the :P1_ERROR variable inside a pl/sql process which was running before the one I tried the conditional processing with.

-- pl/sql process 1.
...
SELECT wwv_flow.g_inline_validation_error_cnt INTO :P1_ERROR FROM DUAL;
-- or this: :P1_ERROR := wwv_flow.g_inline_validation_error_cnt;
...

-- pl/sql process 2.
select *
from user_db_links
where UPPER(db_link) = UPPER(:P1_I_INSTANCE_NAME)
and (UPPER(username) not like UPPER(:P1_USERNAME)
or UPPER(host) not like UPPER(:P1_DB_NAME)
or :P1_PASSWORD is not null)
and :P1_ERROR = 0

This works without any issues. Maybe one of you know why this happens?

Post Tags: