2017-04-03 91 views
-5

我想在bookhangar表中插入plane_id,其中book列的值为'no'。 我bookhangar表oracle sql开发人员更新查询

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'; 

它还多年平均值的工作。

+0

首先任何行,你不能用'将更新where'子句中的INSERT语句,除非'插入... select..where '。你得到了什么错误消息的更新声明? – JSapkota

+0

“INSERT INTO WHERE”可能有什么含义? –

回答

0

如果包含值“不”

update bookhangar set plane_id='PLA104' where lower(trim(book))='no'; 
+0

哇...它现在正在工作....您的查询正在为我工​​作... Thankyou如此之多 – Aadhii

0

你的更新应该工作:

update bookhangar 
    set plane_id = 'PLA104' 
    where book = 'no'; 

如果没有,我会通过检查该查询工作

select * 
from bookhangar 
where book = 'no'; 

开始我怀疑,将不返回行。所以,试试这个:

select * 
from bookhangar 
where book like '%no%'; 

您将需要调查确实被存储什么样的价值。 。 。也许它有隐藏的字符,比如字符串开头的空格。

+0

我的表格有价值...并从bookhangar中选择* where book ='no';上面的查询返回值....我得到了解决方案....解决方案是更新bookhangar set plane_id ='PLA104'在哪里下(修剪(书))='否'; – Aadhii