可以同时在2个表中查,用union all可以保证phone_sihu 表优先级高,phone_sihu 表没有纪录再取phone_xlt纪录:select flag into flag into o_flag from
(select flag from phone_sihu where tele=p_tele
union all
select flag from phone_xlt where tele=substr(p_tele,1,4))
where rownum = 1
(select flag from phone_sihu where tele=p_tele
union all
select flag from phone_xlt where tele=substr(p_tele,1,4))
where rownum = 1
select count(1) into o_count1 from phone_sihu where tele=p_tele;
if o_count1>0 then
select flag into o_flag from phone_sihu where tele=p_tele;
if o_flag=1 then
o_moneys:=3000;
elsif o_flag=2 then
o_moneys:=27900;
elsif o_flag=3 then
o_moneys:=900;
elsif o_flag=6 then
o_moneys:=900;
end if;
else o_flag:=4;o_moneys:=27900;--都没有符合主叫的记录则输出类型为:呼转
end if;
是吗?可我总感觉这样效率很低,不知道有没有更好的办法
when
...
end ;2.decode
then o_flag:=2;o_moneys:=27900; end if;
以及下面还有很多代码都执行了,这没有问题。但假如第一个表:phone_sihu 里有记录,返回了o_flag:=2,o_moneys:=27900;之后就退出来了,显示程序执行完毕。就是说出错模块后面的代码一点都没有执行,因为我是用OOB测试的,一步一步执行的。我感觉还是有问题。