oracle sql开发人员更新查询
我想在bookhangar表中插入plane_id,其中book列的值为“no”。 我的书库桌子是空的oracle sql开发人员更新查询,sql,oracle,Sql,Oracle,我想在bookhangar表中插入plane_id,其中book列的值为“no”。 我的书库桌子是空的 hangar_id | book | plane_id ------------------------------- han103 | no | null han104 | yes |pla102 我的问题是 insert into bookhangar (plane_id) values('pla104') where book='no';
hangar_id | book | plane_id
-------------------------------
han103 | no | null
han104 | yes |pla102
我的问题是
insert into bookhangar (plane_id) values('pla104') where book='no';
但它没有插入
我又问了一个问题
update bookhangar set plane_id='PLA104' where book='no';
它也不工作。您的更新应该可以工作:
update bookhangar
set plane_id = 'PLA104'
where book = 'no';
如果没有,我将首先检查这个查询是否有效
select *
from bookhangar
where book = 'no';
我怀疑这不会返回任何行。那么,试试这个:
select *
from bookhangar
where book like '%no%';
您需要调查实际存储的值。它可能有隐藏字符,例如字符串开头的空格。如果有任何行包含值“否”,它将被更新
update bookhangar set plane_id='PLA104' where lower(trim(book))='no';
首先,在insert语句中不能使用where子句,除非在insert…select..where中。对于那个update语句,您收到了什么错误消息?可以在WHERE中插入什么意思?哇…现在可以了…您的查询对我有效…谢谢您,我的表有很多值…并从bookhangar中选择*其中book='no';上面的查询返回值…我得到了解决方案…解决方案是update bookhangar set plane_id='PLA104',其中lowertrimbook='no';