Oracle UDFs
translate
Offers functionality not available in Teradata SQL. Install this as otranslate(), because we already have a TRANSLATE.
create set volatile table tbl1 (
col1 varchar(20)
, col2 int
) primary index (col1)
on commit preserve rows
;insert into tbl1 Values ( 'A123456', )
;insert into tbl1 Values ( 'AB15234', )
;insert into tbl1 Values ( 'AB-12354', )
;insert into tbl1 Values ( 'ABCD12453', )
;select * from tbl1
;Update tbl1
Set col2 =
trim(syslib.otranslate(col1, 'ABCDEFGHIJKLMNOPQRSTURVWXYZ `~!@#$''%^&*()-_+=[{]}\|";:/?.>,<¨¢¹¦Ä¬—éË‘ÿ’‚ߤÝ', '') )(varchar(20))
where col2 is null
;select *
from tbl1
;
col1 col2
1 ABCD12453 12,453
2 A123456 123,456
3 AB-12354 12,354
4 AB15234 15,234
↧