Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

RPAD is providing incorrect result

646092Jun 20 2008 — edited Jun 21 2008
RPAD function was providing incorrect result given the column contained some Unicode characters...
I believe that the issue is caused by the fact that COLUMN NAME is stored as VARCHAR and as such RPAD expects 1 byte per character thus incorrectly counting the length when encountering the Unicode character that takes 2 bytes.

My solution is to use TO_NCHAR conversion while using the RPAD so it knows to count the characters using UTF-8 encoding, i.e.

RPAD(TO_NCHAR(Columnname, 60))
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2008
Added on Jun 20 2008
13 comments
1,177 views