петак, 27. фебруар 2009.

validations with Apex

Validations with apex expres have step one-13 digits
next NUMERIC and last with condition above>

select :P4_JMBG from dual where
11-(
(
(7*(to_number(substr(:P2_JMBG,1,1))))+
(6*(to_number(substr(:P2_JMBG,2,1))))+
(5*(to_number(substr(:P2_JMBG,3,1))))+
(4*(to_number(substr(:P2_JMBG,4,1))))+
(3*(to_number(substr(:P2_JMBG,5,1))))+
(2*(to_number(substr(:P2_JMBG,6,1))))+
(7*(to_number(substr(:P2_JMBG,7,1))))+
(6*(to_number(substr(:P2_JMBG,8,1))))+
(5*(to_number(substr(:P2_JMBG,9,1))))+
(4*(to_number(substr(:P2_JMBG,10,1))))+
(3*(to_number(substr(:P2_JMBG,11,1))))+
(2*(to_number(substr(:P2_JMBG,12,1))))
)-
(FLOOR(((
(7*(to_number(substr(:P2_JMBG,1,1))))+
(6*(to_number(substr(:P2_JMBG,2,1))))+
(5*(to_number(substr(:P2_JMBG,3,1))))+
(4*(to_number(substr(:P2_JMBG,4,1))))+
(3*(to_number(substr(:P2_JMBG,5,1))))+
(2*(to_number(substr(:P2_JMBG,6,1))))+
(7*(to_number(substr(:P2_JMBG,7,1))))+
(6*(to_number(substr(:P2_JMBG,8,1))))+
(5*(to_number(substr(:P2_JMBG,9,1))))+
(4*(to_number(substr(:P2_JMBG,10,1))))+
(3*(to_number(substr(:P2_JMBG,11,1))))+
(2*(to_number(substr(:P2_JMBG,12,1))))
)
/11))*11))=to_number(substr(:P2_JMBG,13,1))
or
11-(
(
(7*(to_number(substr(:P2_JMBG,1,1))))+
(6*(to_number(substr(:P2_JMBG,2,1))))+
(5*(to_number(substr(:P2_JMBG,3,1))))+
(4*(to_number(substr(:P2_JMBG,4,1))))+
(3*(to_number(substr(:P2_JMBG,5,1))))+
(2*(to_number(substr(:P2_JMBG,6,1))))+
(7*(to_number(substr(:P2_JMBG,7,1))))+
(6*(to_number(substr(:P2_JMBG,8,1))))+
(5*(to_number(substr(:P2_JMBG,9,1))))+
(4*(to_number(substr(:P2_JMBG,10,1))))+
(3*(to_number(substr(:P2_JMBG,11,1))))+
(2*(to_number(substr(:P2_JMBG,12,1))))
)-
(FLOOR(((
(7*(to_number(substr(:P2_JMBG,1,1))))+
(6*(to_number(substr(:P2_JMBG,2,1))))+
(5*(to_number(substr(:P2_JMBG,3,1))))+
(4*(to_number(substr(:P2_JMBG,4,1))))+
(3*(to_number(substr(:P2_JMBG,5,1))))+
(2*(to_number(substr(:P2_JMBG,6,1))))+
(7*(to_number(substr(:P2_JMBG,7,1))))+
(6*(to_number(substr(:P2_JMBG,8,1))))+
(5*(to_number(substr(:P2_JMBG,9,1))))+
(4*(to_number(substr(:P2_JMBG,10,1))))+
(3*(to_number(substr(:P2_JMBG,11,1))))+
(2*(to_number(substr(:P2_JMBG,12,1))))
)
/11))*11))=11

references
http://en.wikipedia.org/wiki/Unique_Master_Citizen_Number
http://apex.oracle.com/pls/otn/f?p=39992:1

Нема коментара: