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
2023-08-03 19:42:58
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