Issue with LPAD/RPAD when using with Japanese data

Hi,
I am trying to apply LPAD/RPAD on Japanese data, but its giving different results than expected.
LPAD/RPAD is returning less data than length passed.
Database: Oracle 10g
Could some one help me on this.
SQL Query: select length('アップリカ'),lpad('アップリカ',5,' '), length(lpad('アップリカ',5,' ')) from dual;
Output:
LENGTH('アップリカ') --> *5*
LPAD('アップリカ',5,'') --> アッ
LENGTH(LPAD('アップリカ',5,'')) --> *3*
Thanks in advance !!
Edited by: 871132 on Jul 7, 2011 8:18 PM
Edited by: 871132 on Jul 7, 2011 8:20 PM
Edited by: 871132 on Jul 7, 2011 8:21 PM

I have made a little research and it seems that your problem is connected with way RPAD function works.
Actually it counts 'display units' instead of 'real' characters count. And in japanesse one 'real' character may be formed from few display units.
Oracle gives some info about it in its official documentation:
http://download.oracle.com/docs/cd/B19306_01/olap.102/b14346/dml_x_reserved010.htm
Some more info is given here:
http://www.rhinocerus.net/forum/databases-oracle-tools/426832-oracle-bug-rpad-japanese-kanji-character-oracle-10gr2-utf8database.html
And also sugestion is given:
+"If you really want the number of characters then you can use+
+something like:+
+RPAD ( str , n - LENGTHC(str),'c')+
+Use LENGTHB, if the requested width is in bytes, LENGTHC, if in+
+characters+
+Or+
+SUBSTR( str || RPAD( 'c', n, 'c' ), 1, n )+
+Use SUBSTRB, if the requested width is in bytes, SUBSTR, if in+
+characters+
+In above the+
+* str is the string to be padded.+
+*'c' is the fill character (usually blank) -- we a assume single-+
+byte char+
+* n is the requested width in bytes or characters+
+"+
Edited by: chudapet on 8.7.2011 1:52

Similar Messages

  • Need help with Digital Certificates when used with Adobe Acrobat

    Hi,
    I need some urgent help for one of my project. Any help or
    guidence would be very much appreciated...
    I am using Digital Certificates with Adobe Reader 6.0 and
    above and currently if I want to install the process it requires
    around 2 steps. Below are the steps.
    Once the install now button is clicked.
    Step 1. Click on set contract set.
    Step2. Click on first un check box, Adobe 7.0 or Adobe 6.0
    Step3. Click OK,
    Now the Question or issue is, I want to make the above
    mentioned steps 1 to step2 automated, once a user downloads this
    Digital certificate over the Web. Else if I can pre-select the 2
    steps for the ease of the user.
    Any help to get this automated would be much
    appreciated......Do let me know if anybody has any further
    questions...
    Pls help...and thanks for helping in advance..much
    appreciated...
    Cheers
    Ashish

    Hi Ashish,
    Since the title of your post refers to Adobe Acrobat, and the
    mention of RoboHelp is conspicuously absent, I suspect you are in
    the wrong forum. You probably need the Acrobat forum instead.
    Regards,
    Anne

  • Having trouble with if else when used with event.value... please help

    Please can someone shed any light on where i'm going wrong.
    I have a pdf form that uses a drop down menu for the SubBrand and a series of checkboxes for the Location.
    the following code is placed as a custom calculation script in an address text field and what im after is dynamically setting the address based on the subbrand and location.
    However whats happening is the address only changes based on the location and not the subbrand.
    Does anyone please have any advice on this.
    Thanks
    if 
    ((this.getField("SubBrand").value == "Passion" || "Passion for Men") && (this.getField("Location").value == "WW")) {
    event.value = "Not Applicable";
    else if ((this.getField("SubBrand").value == "Passion" || "Passion for Men") && (this.getField("Location").value == "US")) {
    event.value = "US02";
    else if ((this.getField("SubBrand").value == "Passion" || "Passion for Men") && (this.getField("Location").value == "WH")) {
    event.value = "WH02";
    else if ((this.getField("SubBrand").value == "Adventure" || "Liquid" || "Silver") && (this.getField("Location").value == "WW")) {
    event.value = "WW01";
    else if ((this.getField("SubBrand").value == "Adventure" || "Liquid" || "Silver") && (this.getField("Location").value == "US")) {
    event.value = "US01";
    else if ((this.getField("SubBrand").value == "Adventure" || "Liquid" || "Silver") && (this.getField("Location").value == "WH")) {
    event.value = "WH01";
    else
    event.value = "";

    Thanks for the tip GIlad I've amended my code but am still experiencing the issue, im at a loss as to what is preventing the address field from changing when the subbrand changes.
    Can you suggest anything else that may be preventing this from happening?
    Updated Code:
    var subBrand = this.getField("SubBrand").value
    var location = this.getField("Location").value
    if      ((subBrand == "Passion" || "Passion for Men") && (location == "WW")) {
            event.value = "Not Applicable";
    else if ((subBrand == "Passion" || "Passion for Men") && (location == "US")) {
            event.value = "US02";
    else if ((subBrand == "Passion" || "Passion for Men") && (location == "WH")) {
            event.value = "WH02";
    else if ((subBrand == "Adventure" || "Liquid" || "Silver") && (location == "WW")) {
            event.value = "WW01";
    else if ((subBrand == "Adventure" || "Liquid" || "Silver") && (location == "US")) {
            event.value = "US01";
    else if ((subBrand == "Adventure" || "Liquid" || "Silver") && (location == "WH")) {
            event.value = "WH01";
    else    event.value = "";

  • Test runner freezing when used with Dynamics CRM (and other apps) - Both applications freeze and never come back...

    We are trying to use test runner with dynamics CRM.
    MS Dynamics CRM will freeze and will not respond (even after 10 - 15 minutes). When this happens, the test manager will either freeze or a message will apear saying "waiting for application under test".
    We are not recording action recordings...This makes using test manager impossible. It happens consistently, starting with slowing the PC down (mouse moving slowly, slow to load in new screens, drop downs etc) eventually leading to the app freezing.
    Tried on windows xp, windows 7 etc on various specs of pcs.

    I am experiencing this same issue with
    Test runner freezing when used with Dynamics CRM. I notice this was first posted in June of 2010 and so far no
    resolution? I was wondering if it could be related to memory issues? Do you have any troubleshooting ideas? The
    issue for me seems to be sporadic and I can't
    reproduce it every time.
    The message I get is "waiting on application under test".
    DLM

  • Camera is hanging when using with flash

    Hi Lenovo Team,
    In lenovo vibe x2, camera is hanging when using with flash.Getting "Lenovo snapit isnt responding" error and screen hanged for sometime.after that when tried to open camera "Cannt cannot to camera " error is coming till when restart the phone.
    Even tried Factory reset and software update.
    Please provide the solution for the above issue.
    Thanks,

    Hi vijayprabhu,
    I just tested the X2 however am not having the issue. I set flash to always on then took a picture using SnapIt however its fine.
    Please check if you have the latest firmware S125.
    Check out the Community Knowledge Base for hints and tips.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    X240 | 8GB RAM | 512GB Samsung SSD

  • I have created a PDF with mp3 audio clips, the file works on PC's with audio playback (WIndows 7, 8 ) however the audio does not play when hosted on a website or an ipad/tablet computer or smart phone when used with PDF reader

    I have created a PDF with mp3 audio clips, the file works on PC's with audio playback (WIndows 7, 8 ) however the audio does not play when hosted on a website or an ipad/tablet computer or smart phone when used with PDF reader

    adobe42135678 wrote:
    the audio does not play when hosted on a website...
    When viewing in what browser?

  • HT4623 Anyone have trouble with iPhone 5c when using Siri?

    Anyone having with iPhone 5c when using Siri?

    I have a problem when I am using the SIRI and have # contacto, for example mark with siri #995012607.

  • ExecuteNonQuery doesnt return number of rows affected when used with PL/SQL

    ExecuteNonQuery doesn't return number of rows affected when used with PL/SQL but returns -1. The documentation says ExecuteNonQuery method of OracleCommand returns the number of raws affected but when used with PL/SQL, it returns -1 even the update statement successfully executes and affects multiple records with no exeptions thrown.
    However, if ExecuteNonQuery is used with update sql statement in the asp.net code it returns number of rows affected correctly. Does anybody know why ExecuteNonQuery behaves like this?
    I am using ODP.NET that comes with Oracle Client 11g. The version is 2.111.6.20 of ODP.NET, Oracle database server is 10g.
    Marat

    You can get the rowcount in the stored procedure via SQL%ROWCOUNT and then pass it out as a parameter.
    For example:
    SQL> create or replace procedure updatesal(v_deptno in number, v_rowsaff out number) as
      2  begin
      3  update emp set sal = sal * 5 where deptno = v_deptno;
      4  v_rowsaff := SQL%ROWCOUNT;
      5  end;
      6  /
    Procedure created.Cheers

  • Quicktime Player with the magic mouse, when used with a bug -

    On 10.7 Lion, Quicktime Player with the magic mouse, when used with a bug …
    Quicktime Player will not respond, but use the USB mouse with no problem

    Message was edited by: b j t

  • Can I use external speakers with the iPad when using Facetime?

    Can I use external speakers with the iPad when using Facetime?  How do I do that?

    They have to be either plugged in via headphone jack or the dock port at the bottom. If you can. I've used it on apple tv, but that's it. I don't know if the others work, but I don't see why not. Try plugging in speakers in the headphone jack. You will get an answer :)

  • Msi x99 gaming 9 ack does not detect capture card when using with xsplit

    msi x99 gaming 9 ack does not detect capture card when using with xsplit
    i install every but still it does not work.

    Hi
    It wasn't hard to find your motherboard version:
    http://www.msi.com/support/mb/Z68AGD80_B3.html#down-bios
    Since your BIOS is v20.1, it couldn't be G3 
    Apart from checking BIOS, you can only check motherboard or moth...

  • I just got iphone 5c and i am not happy with it. It uses to much data and i don't even know how. I can't get the ringtones i want for my contacts.I got it on my free upgrade but i want to take it back and get something else but where i got it they say i c

    I just got iphone 5c and i am not happy with it. It uses to much data and i don't even know how. I can't get the ringtones i want for my contacts.I got it on my free upgrade but i want to take it back and get something else but where i got it they say i can't because i don't have the earbuds and i have serches or them. now i am suck with a phone i don't like at all until my next upgrade. this is very dishearten

    1. If you are this unhappy with that phone, and the lost earbuds is the only thing stopping you from taking it back, why do not just buy some earbuds. That way you can get rid of that phone. It all depend upon how much you want to get rid of that phone.
    2. Yet if you are stuck with that iPhone, here is something might help you to control the data usage. By design, iPhones do turn off WiFi when they go dormant. So if a download is in progress and so forth when the phone goes dormant, it will switch to use cellular data, if this setting is left on. Therefore, from multi-sources I have learned that if you keep your iPhone connected to a power source, then it will stay connected to the available WiFi.

  • OSB & xquery: when use text() or data(...)

    Hi all,
    I'm a beginner on xquery and I'm wondering when use text() or data(...).
    For example I've this simple xml document:
    <book>
    <author>A</author>
    <year>2010</year>
    <price currency="CHF" >100.123</price>
    </book>
    for retrieving attribute value I have to use data(/book/price/@currency)
    but for for retrieving tag value I've two possibilities:/book/price/text() or data(/book/price)
    Are those two expressions the same ? Or ones is evaluated faster than the others ?

    Text() - always returns the String.
    data() - accepts a sequence of items and returns their typed values (return type is xs:anyAtomicType). Calling this function is often unnecessary because the typed value of a node is extracted automatically (in a process known as atomization) for many XQueryXPath 2.0 expressions, including comparisons, arithmetic operations and function calls. The most common use case for the fn:data function is in XQuery element constructors.
    Regards,
    Anuj

  • Issue with " " in file when using file adapter

    Hi,
    Iam using FIle adapter to load the data from file to a table.
    Every thing is working fine, but when ever the record in the file has " " in the data it fails.
    Eg:
    12|"LOG" logo|Y
    I am using file adapter with delimiter | and empty in enclosed by.
    When I intiate the process it throws saying expected delimited | but could not be found . But I am not using any enclosed by clause so it should not check for | after ".
    Any one have any ideas or face this kind of problem.
    Thanks

    Hi,
    Even i faced this issue before...the problem with file adapter is the attribute nxsd:quotedBy takes &quot; as default even if u dont mention it takes the same and now after the quotes it immediately expects | wch is not there in the data and it throws the error...now the fix for the problem is put some symbol for nxsd:quotedBy wch u never expect in the data some thing like less than or greater than symbol ....some thing like below
    <element name="FieldTwo" type="string" nxsd:style="terminated"
    nxsd:terminatedBy="|" nxsd:quotedBy="<"/>

  • File Adapter Issue: Not functioning when used with BIC user modules

    Hi! ALL
    We have been experiencing issue with file adapter, when we SeeBurger BIC user modules in sender file - FTP communication channel.
    The regular FTP functionality is working fine if do not have BIC user modules defined under the module tab.However, when put in BIC user module parameters it is not picking up the file.
    Also, we do not see any error logs; even the communication channel monitoring does not show any error log....only show the polling interval success, without the file being picked up.
    This issue started appearing once we deployed our new sda file....as we changed our BIC mapping.
    We can try doing back to our previous sda file....to see it fixes the problem.
    But, before doing that ....we would like to know where the cause of this issue....Can you point us to any error logs we can find on the PI server.
    Your help is greatly appreciated!!
    Thank you,
    Patrick.

    If you configured your logging correctly you should find in the log folders
    ./applications/com.seeburger.jucon/
    ./applications/com.seeburger.bicxiadapter/
    Try to scan those for recent errors - if the no log files can be found you should check the defaultTrace.

Maybe you are looking for

  • Usb to ethernet adapter?

    I just bought my airport express, and I want to connect my broadband modem to it but the connector is usb instead of ethernet. I did a few searches for an adapter but they all seem to be the opposite, and if I plug it into the express' usb plug it do

  • How to Improve perfomance of this query

    Hi, Please help me to improve this query performance. Objective of this query is to find out individual count who order the product in last two year and create a matrix with time period Challenge is Both the table having more than 600 million record

  • Can i allocate cost from Internal order to PA?

    can i allocate cost from Internal order to PA? if i can . please tell me how to do.

  • Lost pix in iPhoto

    I tried burnng a CD of some pictures from my iPhoto. Went through instructions and pressed "burn", then lost my pictures and now cannot retrieve them. All I get is the spinning circle with the prompt: installing photos". This has been going on for se

  • MAP cannot establish neighborhood to RAP

    Hi, this is in lab environment. I am configuring a RAP and MAP. I have configured already the bridge group name and other prerequisites but my MAP cannot connect to RAP. what could be the problem.