cast 的问题

今天,实施人员给我反应了一个情况,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博客 ” ,链接:http://blog.itpub.net/60217/viewspace-923109/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/60217/viewspace-923109/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值