Validation in Oracle Apex


 


Unique Validation
============

Create Validation on SUPPLIER_NAME item.

Validation Name: Unique_supplier_name

  Type: No Rows Returned


--> SQL Query :

select SUPPLIER_NAME

from   SUPPLIER

where  upper(SUPPLIER_NAME) = upper(:P8_SUPPLIER_NAME);


--> Error massage : This SUPPLIER NAME already Exists...



--> Server-side Condition:

 When Button Pressed: CREATE 


Not Null Validation
============

Create Validation on SUPPLIER_NAME item.


Validation Name : Not_Null_SUPPLIER_NAME

  Type: Item is Not Null

  Item: P8_SUPPLIER_NAME


Error:

 Error Message: You can not blank Supplier name field...



Email Validation Item Matches Regular Expression
=================================

Create Validation on "EMAIL" item. 

Validation:

  Type: Item Matches Regular Expression

  Item: P8_EMAIL

  Regular Expression: @


Error Message: Your E-mail address invalid. 



Specific Character validation 
===================

Create A VALIDATION ON  "NATIONAL_ID" item .

--> VALIDATION TYPE : ITEM CONTAINS ONLY CARACTER SPECIFIED IN VALUE 

--> VALUE SET : 0123456789

--> ERROR MASSAGE : You can input 0 to 9 values

--> ERROR MESSAGE DISPLAY LOCATION (as you like)

--> SERVER SIDE CONDITIONS

      TYPE: REQUEST IS CONTAIN IN VALUE

  VALUE: CREATE,SAVE (this is Button name)


Maximum Character validation 
====================


Type : Function Body (returning Boolean)

PL/SQL :

Declare 
CODE_LENGTH      NUMBER;


BEGIN 
Select LENGTH(:P72_ISO_CODE)
INTO CODE_LENGTH
From dual;

IF  2 < CODE_LENGTH
THEN return false;
else return true;
end if ;
END;



Error Message : You Can use Country ISO code 2 Character.

==============================================================

Create Validation ( :P44_CHGS_CODE = NVD or Number (0-9)

Type : Function Body (returning Boolean)

PL/SQL :

if :P44_CHGS_CODE = 'NVD' 

then return true ;

elsif  REGEXP_LIKE ( :P44_CHGS_CODE, '^.*[a-zA-Z]', 'c')

then return false ;

--else return false;

end if;

=========================================


After 3 letter Hyphen must Validation :

Select Item :

Appearance --> 
widht : 12
Value Placeholder : -

Create Validation : Hyphen_need

Type : Function Body (returning Boolean)

PL/SQL :

if substr(:P48_AIRBILL_NUMBER, 4,1) ='-' then 
return true ;
else 
return false;
end if ;


Post a Comment

Previous Post Next Post