If numbers are null [message #209512] |
Fri, 15 December 2006 05:09 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
marlon_loyolite
Messages: 66 Registered: July 2006
|
Member |
|
|
Hi Friends,
We are migrating our forms application from 6i to 10g and we have some issues here.
The one is ,if numbers are null we have handled that as mentioned below
IF NVL(l_numb1,' ') = NVL(l_numb2,' ')
THEN
.....
ELSE
.....
END IF;
This works fine in 6i , when migrated to 10g it shows error.
But when both the values are VARCHAR2 then no problem.
So I need to handle this in the entire application.I think the only problem
is substituting space(' ') for NUMBER variables.
Do I have any other alternative for this.
Note : It should work for both VARHCAR2 and NUMBER variables.
Regards
Marlon
|
|
|
|
Re: If numbers are null [message #209783 is a reply to message #209512] |
Sun, 17 December 2006 20:38 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
What you have found is one of the issues about which people were complaining. Numbers are not characters or dates.
Either usebegin
IF ( l_numb1 IS NULL
AND l_numb2 IS NULL)
OR l_numb1 = l_numb2 THEN
null;
ELSE
null;
END IF;
end; or pick a value that is not valid for this fieldbegin
IF NVL (l_numb1, -1) = NVL (l_numb2, -1) THEN
null;
ELSE
null;
END IF;
end;
But whatever you do, you have to have the same datatype for both sides of the NVL.
David
|
|
|