我试图翻译'一个月表,带有pl_sql 6.0程序。
我想在一个非常简单的代码中同时运行以下所有这些说明,例如选择说明并同时按F8&#39 ;.
问题是:
没有";"在每条指令之间,我得到:ORA-00933命令未正确结束 用";"在每条指令之间,我得到:ORA-00911无效字符 我是oracle数据库的新手,所以...我没有看到什么?提前谢谢。
update TIME_TABLE t set t.m_description='JANEIRO' where t.m_description like '%JANUARY%'
update TIME_TABLE t set t.m_description='FEVEREIRO' where t.m_description like '%FEBRUARY%'
update TIME_TABLE t set t.m_description='MARÇO' where t.m_description like '%MARCH%'
update TIME_TABLE t set t.m_description='ABRIL' where t.m_description like '%APRIL%'
... and so on
答案 0 :(得分:1)
使用CASE
声明进行更新。
update TIME_TABLE t
set t.m_description = (
case when t.m_description like '%JANUARY%' then 'JANEIRO'
when t.m_description like '%FEBRUARY%' then 'FEVEREIRO'
when t.m_description like '%MARCH%' then 'MARÇO'
when t.m_description like '%APRIL%' then 'ABRIL'
else t.m_description
end
)
答案 1 :(得分:0)
将这些说明放在BEGIN ... END中,就像这样:
BEGIN
update TIME_TABLE t set t.m_description='JANEIRO' where t.m_description like '%JANUARY%'
update TIME_TABLE t set t.m_description='FEVEREIRO' where t.m_description like '%FEBRUARY%'
update TIME_TABLE t set t.m_description='MARÇO' where t.m_description like '%MARCH%'
update TIME_TABLE t set t.m_description='ABRIL' where t.m_description like '%APRIL%'
... and so on
END;
/