码迷,mamicode.com
首页 > 编程语言 > 详细

oralce不像Java,java中字符串+数字,能够得到结果字符串

时间:2018-03-31 17:28:00      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:无法   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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!