We are in the process of evaluating a software package. We have been
looking at their code and have run across what appears to be some strange
code using the "nvl" function. I have included some of their WHERE
clauses which do this:
WHERE cust_no = nvl(null,:c.cust_no) ;
WHERE FOB_CD = nvl(null,:C.FOB_CD) ;
WHERE FREIGHT_CD = nvl(null,:C.FREIGHT_CD) ;
WHERE SHIPVIA_CD = nvl(null,:C.SHIPVIA_CD) ;
WHERE cust_no = nvl(null,:C.billto_cd) ;
WHERE TERMS_CD = nvl(null,:C.TERMS_CD) ;
WHERE cust_no = nvl(null,:C.billto_cd) ;
WHERE HOLD_CD = nvl(null,:C.HOLD_CD) ;
WHERE status_code = nvl(null,:C.order_status) ;
If I understand the "nvl" function then the following expression from the
first where clause
nvl(null,:c.cust_no)
means if null is equal to null then return the value of bind variable
":c.cust_no" which happens to be a screen variable. This means the
expression will always return the value of ":c.cust_no". Is there any
performance reason to do this? I would think this would actually slow the
form down. But the forms which came with the package have this type of
expression in a lot of places.
Thanks!