特殊字符ORA-01480错误的处理
![](http://www.onekao.net/templets/default/images/content_ad.gif)
今天研发同事询问,超长字符串无法INSERT到数据库。但是长度距离VARCHAR2的上限还有很多。只有1700多个字符。
#
检查这个字符按串和对应的错误。发现很怪异,是ORA-01480错误。
#
看看这个错误:
#
01480, 00000, "trailing null missing from STR bind value"
// *Cause: A bind variable of type 5 (null-terminated string) does
// not contain the terminating null in its buffer.
// *Action: Terminate the string with a null character #
原来字符串中包含&这个特殊字符,所以我们需要“处理”这个特殊的字符。
#
可将CHR(38)可以将这个&特殊字符串转换。
#
通过这种转换,含有多个这样特殊字符的字符串可以成功插入数据库。
#