Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> LPAD() bug?

LPAD() bug?

From: wayne <no_at_email.please.com>
Date: 28 Mar 2001 21:30:31 GMT
Message-ID: <99tl5n$soh@freepress.concentric.net>

Hello is it just me, or does LPAD() have a bug (o816 on linux)? Check this query:

select lpad('1234567890',4,'-') "lpad", rpad('1234567890',4,'-') "rpad" from dual;

In other languages, the result should be

"7890" and "1234", as the PADL() function usually truncates if the input string is too long. Oracle returns the following:

lpad rpad
---- ----
1234 1234

I think the LPAD() function should truncate, but truncate within the context of its task, in this case the correct answer should be 7890 not 1234 (truncate the _leading_ characters, not the trailing ones).

What do you people think? Received on Wed Mar 28 2001 - 15:30:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US