Test Target Phone Number Format

Source have phone number with 8 digit and target has 10 digit. How to test target phone number has 10 digit start from +91?

Showing Answers 1 - 3 of 3 Answers

Mitch Grout

  • May 2nd, 2016
 

take the phone number, convert out any puncutation (-, (, )), divide by 9100000000. If the dividend is >1, you have a 10 digit number> 9100000000. If you need a fixed range (such as all 91 - 94 numbers), define the maximum dividend by dividing 9499999999 by 9100000000. If you then divide the phone nmber and get a result less than 1 and greater than the ratio defined above, the number is out of range.

  Was this answer useful?  Yes

Naushad

  • May 17th, 2016
 

Code
  1. SELECT t.phoneno FROM target t, source s WHERE substring(t.phoneno,0,4)=+91

  2. AND +91||s.phoneno=T.phoneno

  Was this answer useful?  Yes

Sirisha d

  • Jan 30th, 2017
 

First Thing: If phone_num is type numeric, + is not allowed.
Second Thing: If phone_num is varchar, and the length of the phone_num is 8 in source, if you want +91 to be appended in the beginning the length will become 11 in target. Not 10.
Considering length in target is 11 below query returns all the phone numbers having +91 in the beginning and having length 11.

SELECT PHONE_NUM FROM TGT_TBL
WHERE SUBSTR(PHONE_NUM,1,3)=+91 AND LENGTH(PHONE_NUM)=11

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions