Subject Re: [firebird-support] How to remove dashes from SSN with Stored Procedure
Author SoftTech
I came up with the following. It works, but seems messy. Is there a better way?


SET TERM ^^ ;
CREATE PROCEDURE STRIP_SSN (
V_SOC_SEC_NO VarChar(11))
returns (
SOC_SEC_NO VarChar(9))
AS
DECLARE VARIABLE sWorkStr VarChar(11);
DECLARE VARIABLE sChar CHAR(1);
begin
sWorkStr = :V_SOC_SEC_NO;
SOC_SEC_NO = '';

WHILE (STRLEN(sWorkStr) > 0) DO
BEGIN
sChar = SUBSTRING(sWorkStr from 1 for 1);
if (sChar <> '-') THEN
BEGIN
IF ((sChar >= 0) OR (SChar <= 9)) THEN
SOC_SEC_NO = SOC_SEC_NO || sChar;
END

sWorkStr = SUBSTRING(sWorkStr from 2 for 11);
END
end
^^
SET TERM ; ^^






----- Original Message -----
From: SoftTech
To: firebird-support@yahoogroups.com
Sent: Monday, August 09, 2010 1:19 PM
Subject: {Disarmed} [firebird-support] How to remove dashes from SSN with Stored Procedure



Greetings All,

I have a soc sec number that I need to remove the dashes from within a
stored procedure.

In other words take sSocSecNo where the value is 123-45-6789 and output
123456789 in SOC_SEC_NO

Is this possible using Firebird 1.5?

If so an example would be great...

Thanks,
Mike




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

[Non-text portions of this message have been removed]