Link to home
Start Free TrialLog in
Avatar of Billy Ma
Billy MaFlag for Hong Kong

asked on

Credit Card Number Validation in PL/SQL

I want to write a function to validation credit card number,
I found a code there
http://www.notesbit.com/index.php/scripts-oracle/validate-the-credit-card-plsql-code/
but I am not sure whether it is good or not.
Anyone can tell?
Avatar of Lee Wadwell
Lee Wadwell
Flag of Australia image

Hi mawingho,

not exactly how I would have written it ... but appears to follow the right rules and do the right job.

lwadwell
Avatar of Billy Ma

ASKER

So the logic is right, :) I am going to use it
ASKER CERTIFIED SOLUTION
Avatar of Lee Wadwell
Lee Wadwell
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i would say the below bit is not exactly correct. VISA card also has 16 digits right ?

.....
IF creditcardlength = 13
   THEN
      IF c1 IN (4)
      THEN
         cardtype := ‘VISA’;
......

Also if at all there is some special "," character in the card number, then we might have to put in the below extra line as well...

....
 creditcardnumber := REPLACE(creditcardnumber, '_', '');
....

I would say you test that code what all kinds of credit cards data you have in your uat /test database/environment and then take a decision accordingly after validating the test results.

Thanks
hi nav_kum_v,
We did handle 16 digit visa card.
thanks