私は2つのテーブルを持っています:-人と銀行の詳細
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;