Mega Code Archive

 
Categories / Oracle PLSQL / Char Functions
 

Using the TRANSLATE() Function

SQL> SQL> --Using the TRANSLATE() Function SQL> SQL> --TRANSLATE(x, from_string, to_string) to convert the occurrences of characters in from_string found in x to corresponding characters in to_string. SQL> SQL> --TRANSLATE(): shift each character in the string SECRET MESSAGE: MEET ME IN THE PARK by four places to the right: A becomes E, B becomes F SQL> SQL> SELECT TRANSLATE('SECRET MESSAGE: MEET ME IN THE PARK',   2     'ABCDEFGHIJKLMNOPQRSTUVWXYZ',   3     'EFGHIJKLMNOPQRSTUVWXYZABCD') FROM dual; TRANSLATE('SECRETMESSAGE:MEETMEINTH ----------------------------------- WIGVIX QIWWEKI: QIIX QI MR XLI TEVO SQL> SQL> --select translate('www.rntsoft.com','wjavscom','abced123') from dual; SQL> SQL>