mask part of a numeric field

Tools & Utilities
Enthusiast

mask part of a numeric field

I have to mask the last 4 digits of a numeric field with xxxx within a sql statement. What is the easiest way to do that?
1 REPLY
Teradata Employee

Re: mask part of a numeric field

Hello,

What I understood, following should be helpful:

SELECT CAST('1234567890' AS VARCHAR(10)) AS A, LENGTH(A) AS B, SUBSTR(A, 1, B - 4) || 'xxxx';

Regards,

Adeel