Postgresql Mask Function

CREATE OR REPLACE FUNCTION public.mask_string_value( p_value text)

RETURNS text

LANGUAGE 'plpgsql'

AS $$

   declare

    var text;

   _arr text[];

begin

   foreach var in array string_to_array(p_value,' ') loop

      _arr=array_append(_arr,substring(var,1,2)||repeat('*',length(var)-2));

   end loop;

return array_to_string(_arr,' ');

end;

$$;

Add comment

Loading