oracle得到的两个字段进行相加,要求都是number类型的,如果两个是字符串会自动转成number类型(前提是能够转)
select a+b from (
select ‘1‘ a,‘2‘ b from z_user
) 对的,输出3
select a+b from (
select ‘1a‘ a,‘2‘ b from z_user
) 错的,无法相加
select a||b from (
select ‘1a‘ a,‘2‘ b from z_user
)对的,输出1a2
标签:无法 blog oralce 字符 结果 rom sel ber from
oracle得到的两个字段进行相加,要求都是number类型的,如果两个是字符串会自动转成number类型(前提是能够转)
select a+b from (
select ‘1‘ a,‘2‘ b from z_user
) 对的,输出3
select a+b from (
select ‘1a‘ a,‘2‘ b from z_user
) 错的,无法相加
select a||b from (
select ‘1a‘ a,‘2‘ b from z_user
)对的,输出1a2
oralce不像Java,java中字符串+数字,能够得到结果字符串
标签:无法 blog oralce 字符 结果 rom sel ber from
原文地址:https://www.cnblogs.com/shenzhichipingguo/p/8682942.html