Catching date conversion exceptions in PL/SQL ...
From: Ludwig Nörg <noergl_at_gmx.net>
Date: 16 Dec 2002 04:32:05 -0800
Message-ID: <a7148654.0212160432.5137afa1_at_posting.google.com>
[Quoted] Hello guys,
END conv_birthday;
Date: 16 Dec 2002 04:32:05 -0800
Message-ID: <a7148654.0212160432.5137afa1_at_posting.google.com>
[Quoted] Hello guys,
[Quoted] [Quoted] I try to convert a number field in the format '[d]dmmyy' with the [Quoted] following construct:
FUNCTION conv_birthday(birthday NUMBER) RETURN DATE IS
ret_birthday DATE;
BEGIN
ret_birthday := TO_DATE(LPAD(TO_CHAR(birthday),6,'0'),
'ddmmyy');
EXCEPTION WHEN OTHERS THEN ret_birthday := NULL; RETURN ret_birthday;
END conv_birthday;
In case the conversion fails I would like to receive a NULL value, but it does not work. It returns with error code ORA-06503 and ORA-06512. Can anybody fix this piece of code?
Thanx in advance,
Ludwig Nörg
Received on Mon Dec 16 2002 - 13:32:05 CET