不是说用‘||’可以将两个字符串连接起来的吗,select * from myDB where name = 'a'||'bc'还请高手赐教试过MySQL和SQLserver,都说我语法错误 那“+”号是所有数据库通用的吗?
3 回答

弑天下
TA贡献1818条经验 获得超8个赞
在MYSQL中字符串连接使用的是concat内置函数。可以写为:select * from myDB where name =concat('a','bc')
在SQL Server中字符串连接用+号。可以写为:select * from myDB where name ='a'+'bc'
在Oracle中字符串连接用的是||号。

慕森卡
TA贡献1806条经验 获得超8个赞
select
*
from
a
where
(SUBSTR(value,
0,
2)
||
'-'
||
SUBSTR(value,
2,
5)
||
'-'
||
SUBSTR(value,
8,
9))
not
in
(select
b
from
data);
或者直接更新valueupdate
a
set
value=(SUBSTR(value,
0,
2)
||
'-'
||
SUBSTR(value,
2,
5)
||
'-'
||
SUBSTR(value,
8,
9));
如果不是ORACLE
的话SUBSTR
换成SUBSTRING
,||换成+

侃侃尔雅
TA贡献1801条经验 获得超16个赞
oracle中是用 || 链接字符串的,
但是你select * from myDB where name = 'a'||'bc'
这种写法也是错的,肯定会报数据库错误的。
- 3 回答
- 0 关注
- 125 浏览
添加回答
举报
0/150
提交
取消