当前位置: 代码迷 >> Oracle开发 >> COLB变量中使用正则表达式替换,该如何处理
  详细解决方案

COLB变量中使用正则表达式替换,该如何处理

热度:544   发布时间:2016-04-24 08:04:07.0
COLB变量中使用正则表达式替换
COLB变量中使用正则表达式替换?
这个如何做?用这个函数报错:regexp_replace

------解决方案--------------------
1) regexp_replace 10g以上才有

2)regexp_replace只支持字符串,CLOB转进去,也是隐式转为字符串的。假如CLOB过长,就会报错


------解决方案--------------------
探讨

1) regexp_replace 10g以上才有

2)regexp_replace只支持字符串,CLOB转进去,也是隐式转为字符串的。假如CLOB过长,就会报错

------解决方案--------------------
REGEXP_REPLACE(source_char, pattern
[, replace_string
[, position
[, occurrence
[, match_parameter ]
]
]
]
)

source_char is a character expression that serves as the search value. It is commonly a character column and can be of any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB or NCLOB.


pattern is the regular expression. It is usually a text literal and can be of any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. It can contain up to 512 bytes. If the datatype of pattern is different from the datatype of source_char, Oracle Database converts pattern to the datatype of source_char. For a listing of the operators you can specify in pattern, please refer to Appendix C, "Oracle Regular Expression Support".



replace_string can be of any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. If replace_string is a CLOB or NCLOB, then Oracle truncates replace_string to 32K. The replace_string can contain up to 500 backreferences to subexpressions in the form \n, where n is a number from 1 to 9. If n is the backslash character in replace_string, then you must precede it with the escape character (\\). For more information on backreference expressions, please refer to the notes to "Oracle Regular Expression Support", Table C-1.