前段时间写Oracle存储过程就遇到问题.
原来写成这样
if 1=2 then
null;
elseif 1=3 then
null
end if;
在PL/SQL编辑环境下elseif没有变色,说明不是关键字。
后来改成
if 1=2 then
null;
else if 1=3 then
null
end if;
编译时报异常。
去goole上百度了下,很多人都说是 elseif。
又试了N边,编译总不能通过。
怒了,直接写成
if 1=2 then
null;
else if 1=3 then
null
end if;
end if;
问题就解决了。
今天又要在存储过程中用if...else if ...else if...写数据转换的东东,还按原来那样写看着很恶心。
后来发现是写成if...elsif...elsif....end if; 没有想到来起了..呵呵
原来写成这样
if 1=2 then
null;
elseif 1=3 then
null
end if;
在PL/SQL编辑环境下elseif没有变色,说明不是关键字。
后来改成
if 1=2 then
null;
else if 1=3 then
null
end if;
编译时报异常。
去goole上百度了下,很多人都说是 elseif。
又试了N边,编译总不能通过。
怒了,直接写成
if 1=2 then
null;
else if 1=3 then
null
end if;
end if;
问题就解决了。
今天又要在存储过程中用if...else if ...else if...写数据转换的东东,还按原来那样写看着很恶心。
后来发现是写成if...elsif...elsif....end if; 没有想到来起了..呵呵
一个'e'弄死人啊》
本文记录了作者在编写Oracle存储过程时遇到的问题及解决过程。主要介绍了在PL/SQL中正确使用if...elsif...endif语法的重要性,并通过实践案例展示了如何避免常见错误。
5521

被折叠的 条评论
为什么被折叠?



