Oracle TRANSLATE Function


/ Published in: SQL
Save to your folder(s)

A few examples of the TRANSLATE function.


Copy this code and paste it in your HTML
  1. --Example 1
  2. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  3. TRANSLATE('Complete IT Professional', 'o', 'X') AS TRANSLATE_TEST
  4. FROM dual;
  5.  
  6. --Example 2
  7. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  8. TRANSLATE('Complete IT Professional', 'Is', 'SW') AS TRANSLATE_TEST
  9. FROM dual;
  10.  
  11. --Example 3
  12. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  13. TRANSLATE('Complete IT Professional', 'IsC m', 'SWx2q') AS TRANSLATE_TEST
  14. FROM dual;
  15.  
  16. --Example 4
  17. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  18. TRANSLATE('Complete IT Professional', 'omsi', '12') AS TRANSLATE_TEST
  19. FROM dual;
  20.  
  21. --Example 5
  22. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  23. TRANSLATE('Complete IT Professional', 'omsi', '') AS TRANSLATE_TEST
  24. FROM dual;
  25.  
  26. --Example 6
  27. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  28. TRANSLATE('Complete IT Professional', 'x', 'a') AS TRANSLATE_TEST
  29. FROM dual;
  30.  
  31. --Example 7
  32. SELECT 'Complete IT Professional' AS SAMPLE_TEXT,
  33. REPLACE('Complete IT Professional', 'let', 'sip') AS REPLACE_TEST,
  34. TRANSLATE('Complete IT Professional', 'let', 'sip') AS TRANSLATE_TEST
  35. FROM dual;

URL: http://www.databasestar.com/oracle-translate/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.