Search code examples
oracle-databaseoracle-apex

Oracle Apex Interactive Grid Validation with Dates


I have a really simple IG on my page:

CREATE TABLE my_table (id number, date_from date, date_to date)

IG is editable (selecting all 3 columns from my_table) and users are able to edit both date fields. I'm trying to create a validation for the dates (function body returning error text):

begin

if TO_DATE(:date_from, 'MM/DD/YYYY') > TO_DATE(:date_to, 'MM/DD/YYYY') then return 
'To date must be prior From date';
else null;
end if;
 
end;

(all options on said validations haven't been modified) Validation is not doing anything, not sure why. Anybody can help?

Thanks


Solution

  • This is Apex 23.1.1 on apex.oracle.com. I created sample table and interactive grid based on it.

    • dates are in dd.mm.yyyy format

    • validation is set to date to column, a function body that returns error text:

      return case when :date_from > :date_to then
                    'To date must be prior From date'
             end;
      

    This is how execution looks like:

    enter image description here