【发布时间】:2017-07-12 02:54:36
【问题描述】:
我需要更新表列为varchar2 数据类型的表,并且需要更新具有'%' 的列的值。
例如——
create table test (id number, name varchar2(20));
insert into test values (1, 'smith');
insert into test values (2, 'allen');
现在我们需要将 NAME 列中的值更新为 smith'%'
所以它还应该在字符串中包含单引号。
我可以将其更新为 smith%,但应该是 smith'%'
update test
set name = 'smith'||'''%'''
where id = 1;
SQL 错误:ORA-00911:无效字符
【问题讨论】:
-
更新不应失败 AFAIK。您确定这是您运行的实际查询吗?
-
我认为 '%' 不是那个字符 ||是
-
它对我有用。 @TimBiegeleisen 是对的。你确定你运行的查询正常吗?
-
@pablomatico 也许 Oracle 有一些无法使用
||进行连接的模式? -
嗯,也许......你在哪里运行更新语句?
标签: sql oracle sql-update