How to frame a query..
I have got an 11 digit no to be generated in a table..
11 digits are distributed as
PPxxxxxxxxM --(Here PP are 10,11,12; xxxxxxxx ranges from 00000000 to 99999999 and the complicated part is the 11th digit which is the MOD 10 of all the 10 digits.)
One way is to go ahead and create a sequence from 1000000000 to 1299999999 but how the MOD10 can be calculated for each number and to be concatenated as 11th digit for each number..
what needs to be done if the intial digits(PPP) required is 100 apart from 10,11,12. :confused:
Re: How to frame a query..
How about: PP * 1000000000 + XX*10.
The final zero won't make any difference to the mod10 result.
Two ways to mod10 it: use TO_CHAR to convert it to a string then loop over the string converting each character into a number, add 'em all up and repeatedly subtract 10 until the result <10.
Another way: get the last digit by subtracting 10*(result/10) from result. Add that to a variable V and divide result by 10. Repeat until result is zero. Then subtract 10*(V/10) from V and that gives you the final digit.
Then just add the checksum to whatever variable the initial PP * 1000000000 + XX*10 result is kept in.
> what needs to be done if the intial digits(PPP) required is 100 apart from 10,11,12.
I've no idea what that means. It can't be 100 because PP is two digits. If it can be 100 then it must be 12 digits distributed as PPPxxxxxxxxM.
|All times are GMT +5.5. The time now is 07:31.|