Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Number to word convertion error
RT wrote:
> Hi,
> I'm trying to spell out 1,721,131.31 using a plsql and got an error
> saying "ORA-01841: (full) year must be between -4713 and +9999, and not
> be 0"
>
> Is anybody ever come across this error before?
Yes - you have a 0 for a date.
> I'm using a function posted on the web as follows:
>
> CREATE OR REPLACE FUNCTION NUMBER_CONVERSION(NUM NUMBER) RETURN
> VARCHAR2
> IS
> A VARCHAR2(1000);
> B VARCHAR2(20);
> X NUMBER;
> Y NUMBER := 1;
> Z NUMBER;
> LSIGN NUMBER;
> NO NUMBER;
> BEGIN
> X:= INSTR(NUM, '.');
that was Error #1
Is NUM a string? No it's a number!
> LSIGN := SIGN(NUM);
> NO := ABS(NUM);
> IF X = 0 THEN
> SELECT TO_CHAR(TO_DATE(NO, 'J'), 'JSP') INTO A FROM DUAL;
And #2
How large was the input param? Over 9999? Presto.
[snip]
-- Regards, Frank van BortelReceived on Thu Apr 28 2005 - 06:18:41 CDT