Re: Problem with using NVL Function ins SQL

From: Ed Prochak <ed.prochak_at_magicinterface.com>
Date: 26 Jan 2005 10:00:43 -0800
Message-ID: <1106762443.068445.22130_at_z14g2000cwz.googlegroups.com>


the above still suffers the same problems test for NULL BEFORE any formatting functions It is unclear for the original post what datatype konten_nr is, If it happens to be numeric, then there is an implicit type conversion. And there is EXPLICIT type conversions going on.

The original line was:
LPAD(TO_CHAR(TO_NUMBER(konten_nr)),8,'0'),

Assuming the datatype of konten_nr is CHAR, then the datatype is changed
CHAR -> NUMBER -> CHAR
WHY all the conversions?

try
LPAD( NVL( konten_nr, '0' ), 8,'0')

If necessary, add an TRIM to remove excess leading zeroes, but there is NO need for the TO_NUMBER() type conversion. Received on Wed Jan 26 2005 - 19:00:43 CET

Original text of this message