How to check string Pattern in store Procedure
In our App,the system is doing the DB data validation by calling the store procedure from pega so if conditions are not satisfied then store procedure will send an error message to pega and display it same on page, but here it should validate the pattern of data.
I tried to below SQL function but it's returning nothing.
select * from [table_name] where REGEXP_Like (Col1, '^[0-9A-Z]{1,2}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,5}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}$');
Pattern : ^[0-9A-Z]{1,2}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,5}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}$
sample data format: 41.4960.1172.64110.0000.0000.0000
How to validate the pattern of DB column data ?
Note : we already defined the same pattern at property level through "Edit Validate" rule and it's working fine. But it should be done same through DB as well
Edit Validate:
String segment = "^[0-9A-Z]{1,2}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,5}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}\\.[0-9A-Z]{1,4}$";
java.util.regex.Pattern p = java.util.regex.Pattern.compile(segment);
java.util.regex.Matcher m = p.matcher(theValue);
boolean isSegment = m.matches();
if((isSegment == false) ){
return false;
}
return true;