Fido Dido
Fido Dido

Reputation: 209

pl sql validations on apex oracle database application forms

I need validations for three different forms

1- not null validation

2- value entered must be between 1 and 100

3- and selected date can't be before 5/10/2000 dd/mm/yyy

Upvotes: 0

Views: 2788

Answers (2)

Paweł Prusinowski
Paweł Prusinowski

Reputation: 416

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 100 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/10/2000' end if; 

return null;

Additionally in Error Message type:

Unknown error.

Regards

Upvotes: 0

Littlefoot
Littlefoot

Reputation: 142713

  1. Right-click an item and create validation whose type is "Item is not null". Or, set it to be "required" (in its properties)
  2. Set its "minimum and maximum" allowed values in its properties. If you have to create a validation, then make it a function that returns a Boolean (or Error text), such as

    return :P1_ITEM not between 1 and 100;
    
  3. The same as #2 ...

    return :P1_DATE_ITEM >= date '2000-10-05';
    

Upvotes: 1

Related Questions