Oracle替换函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle替换函数相关的知识,希望对你有一定的参考价值。

A few examples of the Oracle REPLACE function
  1. /*REPLACE*/
  2.  
  3. /*Example 1*/
  4. SELECT 'Today is the 26th of February, 2015' AS ORIGINAL_STRING,
  5. REPLACE('Today is the 26th of February, 2015', 'a', 'X') AS REPLACE_STRING
  6. FROM dual;
  7.  
  8. /*Example 2*/
  9. SELECT 'Today is the 26th of February, 2015' AS ORIGINAL_STRING,
  10. REPLACE('Today is the 26th of February, 2015', 'the', 'probably the') AS REPLACE_STRING
  11. FROM dual;
  12.  
  13. /*Example 3*/
  14. SELECT 'Today is the 26th of February, 2015' AS ORIGINAL_STRING,
  15. REPLACE('Today is the 26th of February, 2015', 'th') AS REPLACE_STRING
  16. FROM dual;
  17.  
  18. /*Example 4*/
  19. SELECT 'Today is the 26th of February, 2015' AS ORIGINAL_STRING,
  20. REPLACE('Today is the 26th of February, 2015', 'X', 'Y') AS REPLACE_STRING
  21. FROM dual;
  22.  
  23. /*Example 5*/
  24. SELECT 'Today is the 26th of February, 2015' || CHR(13) AS ORIGINAL_STRING,
  25. REPLACE('Today is the 26th of February, 2015' || CHR(13), CHR(13), ' ') AS REPLACE_STRING
  26. FROM dual;
  27.  
  28. /*Example 6*/
  29. SELECT 'Today is the 26th of February, 2015' || CHR(13) || CHR(10) AS ORIGINAL_STRING,
  30. REPLACE('Today is the 26th of February, 2015' || CHR(13) || CHR(10), CHR(13) || CHR(10), ' ') AS REPLACE_STRING
  31. FROM dual;
  32.  
  33. /*Example 7*/
  34. SELECT NULL AS ORIGINAL_STRING,
  35. REPLACE(NULL, NULL, 'x') AS REPLACE_STRING
  36. FROM dual;
  37.  
  38. /*Example 8*/
  39. SELECT 'My first name is (x), my last name is (y), and I am from (z).' AS ORIGINAL_STRING,
  40. REPLACE(REPLACE(REPLACE('My first name is (x), my last name is (y), and I am from (z).', '(x)', 'John'), '(y)', 'Smith'), '(z)', 'England') AS REPLACE_STRING
  41. FROM dual;
  42.  
  43. /*Example 9*/
  44. SELECT 'What''s the date today?' AS ORIGINAL_STRING,
  45. REPLACE('What''s the date today?', '''', '"') AS REPLACE_STRING
  46. FROM dual;
  47.  
  48. /*Example 10*/
  49. SELECT 'What''s the date today?' AS ORIGINAL_STRING,
  50. REPLACE('What''s the date today?', '''') AS REPLACE_STRING
  51. FROM dual;

以上是关于Oracle替换函数的主要内容,如果未能解决你的问题,请参考以下文章

替换从 VAST 代码返回的多个 HLS VOD 片段

替换或删除后台堆栈上现有片段的代码不起作用

如何从主要活动中替换片段

用片段替换时操作栏向下移动

如何在android studio中用另一个片段替换一个片段

用片段替换某些东西