NVL Values
binnyasnOct 19 2005 — edited Oct 19 2005Hello All,
After so many days I'm revisiting PL/SQL. I have one clarification needed.
I have PL/SQL Block as below
declare
cursor c1 is select * from test order by 1 desc;
break c1%rowtype;
crows c1%rowtype;
nrows c1%rowtype;
begin
break.id := '';
break.name := '';
break.ddate := '';
for rec in c1 loop
exit when c1%notfound;
nrows.id := rec.id;
if break.id <> rec.id
then
break.id := rec.id;
.............. some statements
end if;
end loop;
end;
/
If I'm not wrong, the IF condition within the loop should have NVL function right. Since I'm assigning break.id with NULL value. We can not able to compare NULL with any values. Should be like below right:
IF NVL(break.id, 1) <> NVL(rec.id,1)
THEN
.....
END IF;
This true right?.
I wanted 2 make sure that this is true that we can not comare any "NULL" values to the ANY VALUES.
Or else any other way of doinee it?
Thanks in advance
Binny