declare
cursor c(k1 varchar2,
k2 varchar2,
k3 varchar2,
k4 varchar2,
v1 varchar2,
v2 varchar2,
v3 varchar2,
v4 varchar2)
is(select *
from (select ResponseData.*,
case
when (k1 = key1 and v1 <> value1)
or (k1 = key2 and v1 <> value2)
or (k1 = key3 and v1 <> value3)
or (k1 = key4 and v1 <> value4)
or (k2 = key1 and v2 <> value1)
or (k2 = key2 and v2 <> value2)
or (k2 = key3 and v2 <> value3)
or (k2 = key4 and v2 <> value4)
or (k3 = key1 and v3 <> value1)
or (k3 = key2 and v3 <> value2)
or (k3 = key3 and v3 <> value3)
or (k3 = key4 and v3 <> value4)
or (k4 = key1 and v4 <> value1)
or (k4 = key2 and v4 <> value2)
or (k4 = key3 and v4 <> value3)
or (k4 = key4 and v4 <> value4)
then 'not match'
else 'match'
end ok
from ResponseData)
where ok = 'match'
or ok = 'not match'); -- debug mode
begin
for r in c('name', null, null, 'age', 'Apple', null, null, '22') loop
dbms_output.put_line(r.id||': ('||r.key1||'=>'||r.value1||'), ('||r.key2||'=>'||r.value2||'), ('
||r.key3||'=>'||r.value3||'), ('||r.key4||'=>'||r.value4||') - '||r.ok);
end loop;
end;