我正在尝试将下面的Sybase查询转换为Oracle查询。
update Student set st.age = (case when st.promoted != 'fail' then 1
else (select sc1.age from school sc1 where st.id = sc1.id ) END)
from Student st ,School sc
where st.id = sc.id
AND st.status in('1','7','2','5')
AND st.currentClass = sc.currentClass
AND st.currentCource = sc.currentCource ;
但是我尝试在转换后在Oracle查询下面执行,但是出现以下错误。
update Student st set st.age = (select (case when st.promoted != 'fail'
then 1
else (select sc1.age from school sc1 where st.id = sc1.id ) END)
from School sc
where st.id = sc.id
AND st.status in('1','7','2','5')
AND st.currentClass = sc.currentClass
AND st.currentCource = sc.currentCource )
where exists
(select 1 from School sc1
where st.id = sc1.id
AND st.status in('1','7','2','5')
AND st.currentClass = sc1.currentClass
AND st.currentCource = sc1.currentCource);
返回查询:ORA-01427单行子查询返回多个行。任何人请帮忙
update Student st set st.age = case when st.promoted != 'fail'
then 1
else (select sc1.age from school sc1
where st.id = sc1.id )
end
where exists
(select 1 from School sc1
where st.id = sc1.id
AND st.status in('1','7','2','5')
AND st.currentClass = sc1.currentClass
AND st.currentCource = sc1.currentCource);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句