我有两张桌子: - 个人和银行详细信息
Person table :---
person_id employee_number
393829 X1029
648494 x9494
393939 X2299
Bank details :---
person_id bank_form
393829 Reimb
393829 Sal
648494 Sal
393939 Common
现在,如果某个人的银行表格为“sal”和“reimb”,则必须打印“This is it”。如果他只有“common”作为银行表格,则也无需执行任何操作。我为此做了一个光标。但是“这就是它”行不起作用。
Create or replace package body xx_bank_details
as
procedure xx_bank_details_proc(
ERRBUF out varchar2,
RETCODE out varchar2
)
Cursor c1
is
select person_id
from person;
Cursor c2(p_person_id)
is select bank_form
from bank_details
where bank_details.person_id=p_person_id;
begin
for cur_c1 in c1
loop
for cur_c2 in c2(c1.person_id)
loop
if(cur_c2.bank_details='Sal')
then
l_sal :='Sal';
end if;
if(cur_c2.bank_details='Reimb')
then
l_reimb :='Reimb';
end if;
if(cur_c2.bank_details='Common')
then
l_common :='Common';
end if;
end loop;
if (l_sal is not null and l_reimb is not null)
then
fnd_output.put_line("This is it !");
end if;
end loop;
end xx_bank_details_proc;
end xx_bank_details;