今天运行SP的时候,居然蹦出来ORA-0460的错误。查看错误日志找到问题所在。噢, 原来是string more than 4000。顺手查看系统上的SP, 发现都有这个共同毛病,给某些变量赋值的时候用 SELECT .... INTO ..... FROM DUAL; 为避免这个错误,最好是直接赋值。
总结一下这个错误会出现的机制情况, 最容易想到的就是to_char, to_date, to_number, 其他的场景可能...
ORA-01460 unimplemented or unreasonable conversion requested
Cause: The requested format conversion is not supported.
Action: Remove the requested conversion from the SQL statement. Check the syntax for the TO_CHAR, TO_DATE, and TO_NUMBER functions to see which conversions are supported.
There are other reported causes of the ORA-01460 as well:
- Incompatible character sets can cause an ORA-01460
- Using SQL Developer, attempting to pass a string to a bind variable value in excess of 4000 bytes can result in an ORA-01460