开发者

db2 cast problem

开发者 https://www.devze.com 2023-01-29 10:32 出处:网络
[SQL]2010/12/07 20:18:32:184 : 0.0010 [update REG_COMP_DEF set OrderNo = Cast(Cast(SUBSTR(orderno,1,10) as numeric(10,0))+10 as varchar(10))||NVL开发者_Python百科(SUBSTR(orderno,10+1,length(orderno)-1

[SQL]2010/12/07 20:18:32:184 : 0.0010 [update REG_COMP_DEF set OrderNo = Cast(Cast(SUBSTR(orderno,1,10) as numeric(10,0))+10 as varchar(10))||NVL开发者_Python百科(SUBSTR(orderno,10+1,length(orderno)-10),'') where length(OrderNo)>10 and OrderNo>='3000600050' and OrderNo like '300060%' and OrderNo not like '999999%'] com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -461, SQLSTATE: 42846, SQLERRMC: SYSIBM.DECIMAL;SYSIBM.VARCHAR

inner cast is ok


I can run it on my DB2 for i system (without the NVL(); not supported in my version).

Can you see if the outer cast will run when the inner one is cast to Decimal() instead of Numeric()?

ref: SQLState 42846 = "Cast from source type to target type is not supported."

0

精彩评论

暂无评论...
验证码 换一张
取 消