|Subject||RE: [firebird-support] Soc Sec No comparison using Firebird|
create procedure social_number_comparison (
declare variable x1 char(20);
declare variable x2 char(20);
declare variable e smallint;
declare variable e1 smallint;
declare variable e2 smallint;
declare variable i smallint;
i = 0; x1 = i1; x2 = i2; e = 0;
while (i < 20 and e < 3) do
i = i + 1;
if (substring(x1 from i for 1) <> substring(x2 from i for 1)) then
e = e + 1;
if (e = 1) then e1 = i;
else if (e = 2) then e2 = i;
if (e = 0) then result = 'OK';
else if (e = 3) then result = 'Not equal';
else if (e = 1) then result = e1 || '. character ' || substring(i1 from i for 1) || ' has changed';
if (substring(x1 from e1 for 1) = substring(x2 from e2 for 1) and
substring(x1 from e2 for 1) = substring(x2 from e1 for 1)) then
result = e1 || ' and ' || e2 || ' were swapped';
I would like to pass into a stored procedure two social security numbers for comparison and have the result tell me if one character has changed, or if two characters were switched or if it does not compare at all.
Has anyone done anything like this they could share? Or is it even possible?
This email has been checked for viruses by Avast antivirus software.
Ta e-pošta je bila pregledana z Avast protivirusnim programom.