SELECT J.NOSTAF, J.NOKP, J.NOKPR, J.NOKPT, J.NAMA
FROM (SELECT A.NOSTAF, A.NOKP, REPLACE(A.NOKP, ' ', '') AS NOKPR,
TRANSLATE(A.NOKP, 'A', 'B') AS NOKPT,
A.NAMA FROM TANGGUNGAN A) J
WHERE J.NOSTAF LIKE '%';
//REPLACE ([string], [string to replace], [replacement string] )
//TRANSLATE([string], [string to replace], [replacement string] )
with oracle 10g
original data set sample :-
NOSTAF, NOKP, NAMA,
01, A 1111111, ABU
02, A2222222, BAN
03, A3 3 3 3 333, COT
illustrated output :-
NOSTAF NOKP NOKPR NOKPT NAMA
01 A 1111111 A1111111 B1111111 ABU
02 A2222222 A2222222 B2222222 BAN
03 A3 3 3 3333 A3333333 B3333333 COT