Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> LPAD() bug?
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
![]() |
![]() |