sql - Oracle regular expression REGEXP_LIKE for multiple columns -


i want validate tax , name, telephone no . should alpha-numeric.so used method in here want know can same short method in way without using many "and" s.

  if regexp_like(i.tax, '^[a-za-z0-9]+$') , regexp_like(i.name, '^[a-za-z0-9]+$') , regexp_like(vartelephone , '^[a-za-z0-9]+$')        insert bizzxe_v2_sch.supplier_contacts       (contact_id, supplier_id, address, zip_code, country_id, city_id, telephone, fax, email, xmlcol)       values(varcontactid ,varid, k.address, k.zip_code, k.country_id, k.city_id, k.telephone, k.fax, k.email, varcontactdetail);       else         -- start return rval messages --        rval.ex_code:=1;        rval.message:='supplier tax , supplier name should apha-numeric numbers letters , symbols..!';        -- end return rval messages --      end if; 

since need match same regex pattern, alphanumeric, can validate on concatenation of these 3 values:

if regexp_like(i.tax || i.name || vartelephone , '^[a-za-z0-9]+$') 

however not behave question condition, since if 1 or 2 of values empty, evaluated true in case , not in other.

a possible workaround , in case need different regex, telephone verifying digits ()- , + instance, this:

if regexp_like(i.tax || ' ' || i.name || ' ' || vartelephone ,      '^[a-za-z0-9]+ [a-za-z0-9]+ [\d()\-+]+$') 

for case have make sure chosen separator, in case space never appear in of input texts.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -