Почему игнорируется блок с if и сразу переходит на case блок когда я запускаю функцию?create or replace function aaa_aaa(
cel_cred in varchar2,
prog_cred in varchar2,
dog_num_ in varchar2 default NULL
)
return varchar2 is
res varchar2(10);
begin
if cel_cred = '051' and dog_num_ is null then
if prog_cred = '16102' then
res := '006';
elsif prog_cred = '16155' then
res := '007';
end if;
end if;
case
when prog_cred = '16153' and cel_cred ='051' then
select case
when AAA in (206, 207, 208, 209, 210, 211, 212, 220, 221, 17) then
'029'
when AAA not in (206, 207, 208, 209, 210, 211, 212, 220, 221, 17) then
'007'
end
into res
from tab_name t
where t.BBB=dog_num_;
dbms_output.put_line(res);
when prog_cred = '16103' and cel_cred ='051' then
select case
when AAA not in (206, 207, 208, 209, 210, 211, 212, 220, 221, 17) then
'007'
when AAA in (206, 207, 208, 209, 210, 211, 212, 220, 221, 17) then
'029'
end
into res
from tab_name t
where t.BBB=dog_num_;
else res:=cel_cred;
end case;
return res;
end aaa_aaa;