DROP TABLE table1;
CREATE TABLE table1
(
Vaccinationstatus VARCHAR(10),
Vaccinated VARCHAR(3)
);
INSERT INTO table1 (Vaccinationstatus)
VALUES ('yes');
SELECT * FROM table1;
UPDATE table1
SET table1.Vaccination_status = 'Vaccinated'
WHERE table1.Vaccinated = 'yes'
UPDATE table1
SET table1.Vaccination_status = 'Vaccinated'
CASE
WHEN table1_Vaccinated = 'Yes'
ELSE Vaccination_status
-- If the table1.Vaccinated say 'yes' depending on the row which said yes update the table1.Vaccination_status to 'Vaccinated' for those row that said yes only--
END;我一直在犯错误:
ORA-00933: SQL命令未正确结束。
我试图将table1.Vaccination_status更新为unvaccinated,只有当行的table1.Vaccinated = 'YES'表示是,而不是对拒绝的人进行更新时。
我也想使它,使它只更新,如果这些条件是满足。我尝试了一个更新声明,但我认为我做得不对。
有什么想法吗?
发布于 2021-12-15 13:28:02
根据错误,你没有得到反馈的要点。有一个语法错误:在一个语句的末尾缺少一个分号:
UPDATE table1 SET table1.Vaccination_status = 'Vaccinated' WHERE table1.Vaccinated = 'yes';
除此之外,确实要以同样的方式拼写“是”和“是”。我建议使用数值列,值为0 (no,false)或1(是,true)。这样才能防止这类常见的错误。
https://stackoverflow.com/questions/70356062
复制相似问题