In Oracle Apex, there are several types of validation that you can use to validate an item. But if the validation requires to check multiple conditions and need to display the relevant error messages, then you should choose the
PL/SQL Function (returning error text) type of validation. Because using this type, you can show the relevant error messages easily.
PL/SQL Function (returning error text) Example
This validation type aborts the page submit if the PL/SQL function returning text message and shows that text as an error message, and if it is not returning any text, then it means the validation is successful.
The following PL/SQL function example will validate the student’s roll number, that it should start with the letter ‘S’ and should have seven-character length.
If any of the conditions will not match, then it will give the appropriate error message.
Begin If substr(:p11_roll_no, 1, 1) != 'S' Then return('Roll number must start with S.'); Elsif length(:p11_roll_no) < 7 Then return('Roll number must be 7 character long.'); End If; End;