In an Apex 4.1.1 application I have a form on an "Entries" table that also uses codes from a separate "Reason_Codes" table. When my users are entering data on the form, the Reason Code field is text with autocomplete; this would allow the user to select from existing codes or to declare a new value if it does not yet exist on the table.
The value in this field can easily be entered on a new line on the "Entries" table, but the new reason code must also simultaneously be entered on the "Reason_Codes" table as a new value so it can then be used in the future. I have created a page process to INSERT this value on the proper table after clicking a submit button, only if it meets the condition that this value does not already exist on the table. Thus, I made the condition expression as follows (condition type is NOT Exists):
SELECT 1 FROM REASON_CODES
WHERE UPPER(NAME) = UPPER(:p49_RC)
When I run the page to test this, the value is not inserted. I tested the INSERT function with a simpler condition expression (and with the process point being On Load, condition type "Exists"):
SELECT 1 FROM dual
WHERE :P49_RC is not null
The insert functions as written in this simple case.
What might I be missing here?