Re: Mask Account Number in Query

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 08 Sep 2005 11:37:48 -0700
Message-ID: <1126204621.900502_at_yasure>


Malcolm Dew-Jones wrote:
> brett.birschbach_at_cellcom.com wrote:
> : In response to DA Morgan, That works fine if I know the length of the
> : account number. However, it doesnt work with varying lengths. The
> : replacement would be hardcoded to a certain number of asterisks, so in
> : my previous example, the accounts would show as
>
> : 123456 -> ******3456
> : 1234567890 -> ******7890
>
> Oracle SQL has lots of string manipulation functions. (Heck I think that
> even generic SQL has these functions.)
>
> One basic idea is to use one of those functions to find the length of the
> string, and then subtract four from that length, and then replace that
> many characters at the start of the string with the * character.

Exactly. A little INSTR ... a little LPAD ... and you're in business in a matter of a few minutes.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Thu Sep 08 2005 - 20:37:48 CEST

Original text of this message