0
votes

I need 3 validations for my apex oracle database application and can't seem to find the solution.

  • validation so that the field cannot be Null
  • Validation so that the number entered must be between 1 and 1000
  • Validation so that the date of birth cannot be after 5/6/2018 (dd // mm / yyyy format)

These validations are used in the form using CREATE VALIDATION in the edit page

2
Are you want to validate this at the database level with the table? i.e. inside CREATE TABLE statement??user8406805
Do you want to add all these 3 validations over the same field, I think not, might be in two different fields. So can you also update the table structure that you still tried out?user8406805
These validations are used in the forms using CREATE VALIDATION in the edit page and they are used for three different fieldsFido Dido

2 Answers

1
votes

Create new Validation with type PL/SQL Function (returning Error Text) with code:

if :P1_ITEM1 is null then return 
'P1_ITEM1 is null' end if; 

if :P1_ITEM2 not between 1 and 1000 then return 
'P1_ITEM2 not between' end if; 

if to_date(:P1_ITEM3, 'DD/MM/YYYY') >= to_date('05/10/2000') then return 
'P1_ITEM3 earlier than 05/06/2018' end if; 

return null;

Additionally in Error Message type:

Unknown error.

Regards

1
votes
  • create a validation by right-clicking the item, and choose its type to be item is NOT NULL.
    • alternatively, set item's "Value required" property to "Yes".
  • that item is a "Numeric field", so - set its "Minimum" and "Maximum value" properties to desired values
  • date of birth looks like a SYSDATE (i.e. today's date). If that's so, set its "Maximum value" to +0d
    • + as to "future"
    • 0 as "zero"
    • d as "days"