Thursday, June 8, 2017

Data Validation


In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,


        A reliable application, relies on data validation methodology. It involves     
  recognizing the business rules and applying the five  types of data validations. 

 Data Validation Types:

1.     Code validation 
2.      Data type validation 
3.      Data range validation
4.     Constraint validation
5.      Structured validation

Task Definition:   

    Today's task is to use data validation in a specific formula. This requires you to check out the input of the left hand side must logically equal the right hand side of the mathematical equation.
   
     Let's assume that we have an estimated plan for issuing the total annual quantities of the raw material for production in a factory. Then, the system should check for accurate user input before saving; the estimated total quantity must equal all raw material quantities entered by the user. 

e.g.   Total =  item1 +  item2 +  item3 

 If the logical equation violated, then you must prevent the user from saving the data into the database.


Task Solution:

 There are two ways to apply a solution for this task:


1- Create WHEN-VALIDATE-RECORD Trigger (block level)


DECLARE

    v_total   NUMBER  :=0 ;

BEGIN
     
     v_total  := NVL(:item1,0) + NVL(:item2,0) + NVL(:item3,0) ; 

IF tot  <> :total THEN

     -- Create a message or Alert here 

MESSAGE('Quantities Don't Match');

PAUSE;

 RAISE FORM_TRIGGER_FAILURE;

END IF;

END;




If  the data validation is accurate, it works fine. Otherwise the data condition will be violated and the trigger will fire to Prevent inaccurate data from saving the form.


2- Create PRE-INSERT or PRE-COMMIT Trigger ( form level)


DECLARE

     v_total  NUMBER  :=0 ;

BEGIN

    v_total  := NVL(:item1,0) + NVL(:item2,0) + NVL(:item3,0) ;

IF v_total  <> :total THEN

     -- Create a message or an alert here 

MESSAGE('Please Check Related Quantities to FormItem1');
PAUSE;

-- To prevent a user fro saving the violated condition use...

     RAISE FORM_TRIGGER_FAILURE;

END IF;

END;




Learn more about:

           Oracle Report With No Data
·          Oracle Forms Data Exchange
·           


Hope this helps...

My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.





No comments :