ITPub博客

首页 > 应用开发 > IT综合 > cast 的问题

cast 的问题

原创 IT综合 作者:jordan1226 时间:2007-07-02 12:41:57 0 删除 编辑

今天,实施人员给我反应了一个情况,SELECT DISTINCT CAST(WF_ID AS VARCHAR(20)) WF_ID, 这样的语句会提示ORA-00910: specified length too long for its datatype

通过查找资料发现,可能是CAST在EJB中,在使用上可能有一些bug,具体说明如下:

[@more@]

The EJB application using container-managed persistence beans might fail to run with the sql syntax

Symptom:

The EJB application using container-managed persistence beans might fail to run with the sql syntax. This is an Oracle syntax error dealing with an SQL CAST operation. You can see the following exception in the system:

log java.sql.SQLException: ORA-00910:specified length too long for its datatype

Problem:

The problem is a bug in the EJBDeploy program.

Description:

An incorrect CAST operator is generated into SQL for EJB entity beans. This happens when there are multiple EJB-RDB mappings in the EJB or JAR file and one of the mappings is for DB2 and another of the mappings is for another database such as Oracle. When there are multiple mappings, the EJBDeploy tool incorrectly assumes that all mappings are for DB2 and generates incorrect sql for the Oracle case.

Response:

You can work around the problem by removing the unused mappings for the EJB or JAR file.

http://publib.boulder.ibm.com/infocenter/wasinfo/v5r0/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/relnotes/relnotes_zos.html

所以,我发觉如果不是必须最好不要用,很多可以用类似的语句实现,例如,以上的语句,就可以TO_CHAR来实现。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/60217/viewspace-923109/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 制作汇总报表
请登录后发表评论 登录
全部评论
  • 博文量
    48
  • 访问量
    500601