Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NVL Values

binnyasnOct 19 2005 — edited Oct 19 2005
Hello 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2005
Added on Oct 19 2005
3 comments
261 views