Hi,
I have a table T with 3 columns ID number and name varchar2(500) and address Varchar2(500). I wrote a PL/SQL procedure which uses a cursor based on table T and makes some processing if the actual row in the cursor has an address which has a value which is not NULL, and another processing if address has the value NULL.
Here's my procedure:
create or replace procedure proc_T is
cursor cur is select id, name, address
from T
order by id;
BEGIN
FOR c in curs
LOOP
If c.address is null then
--processing1
else
-- processing2
end if;
END LOOP;
END;
My table contains 20 rows.
The problem is that for the first iteration in the for loop, I'm sure c.address has the value NULLl, but processing1 is not done, and instead, it's processing2 which is done. How should I do to ensure that if c.address has the value NULL, then the procedure enters in the if branch( i.e. executes processing1) and not in the else branch (where processing2 is executed)?
Thanks.