prashant
prashant

Reputation: 3

plsql code to replace values of a column with characters

if there is a name column

name

prashant

ram

then the column values should become like this name

##############################
# Name     |  Replaced_value #
##############################   
# prashant |    XXXXXXXX     #
#          |                 #
# ram      |    XXX          #
##############################

It has to replaced by same number of Xs.

Upvotes: 0

Views: 303

Answers (2)

Aspirant
Aspirant

Reputation: 2278

This will work !!

select name,substr(lpad(name,length(name)+length(name),'X'),1,length(name)) as replaced_name from table

Upvotes: 0

A Hocevar
A Hocevar

Reputation: 726

You can combine lpad/rpad and length

LPAD('X',LENGTH(InputString),'X')

Upvotes: 3

Related Questions