Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    1

    Unanswered: Serious problem with UNICODE

    Here's the problem.
    Stored procedure has 2 input parameters, X and Y.
    Procedure creates another variable Z.
    Value of parameters X and Y is the same- ĈĞŦŞǙ ( yes, this are real letters!).

    During parameter handling through procedure, value of parameter X is stored in varijable Z

    SET Z=X;

    and parameter Y and variable Z are inserted in database table.


    INSERT Z,Y into table where etc,etc,etc.....

    Table columns are defined as UNICODE (with purpose to support those kind of letters!)


    Input parameters X and Y are varchar(50)
    (IN X VARCHAR(50), IN Y VARCHAR(50))


    variable Z is defined as
    DECLARE Z VARCHAR(50) CCSID UNICODE;


    Procedure itself is defined as


    CREATE PROCEDURE TEST.M19TEST (
    IN X VARCHAR(50),
    IN Y VARCHAR(50))


    ASUTIME LIMIT 1 RESULT SETS 1
    LANGUAGE SQL
    FENCED
    COLLID M19OMATI
    PARAMETER CCSID UNICODE
    WLM ENVIRONMENT T0DBWLOW
    RUN OPTIONS 'NOTEST(NONE,*,*,*)'


    so, everything is UNICODE defind (or am I missing something???)

    But, after insert i got different value in database table. Input parameter Y is inserted fine (ĈĞŦŞǙ),while variable Z is not, it does not support those kind of lettersm i only get a lot of garbage.( Ş ).

    Further testing it, I came to conclusion that the encoding is lost while setting variable Z with value of parameter X.

    SET Z=X;

    So, to conclude, parameter Y is inserted fine because stored procedure only stores input value of Y, while X is first 'copied' to Z, and then Z is inserted.
    If any operation is done with input data, it loses encoding.

    Any ideas? suggestions? Please, I'm desperate!


    Thank you very much


    P.S. we are using zOS and DB2 v9

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Wild guess: try VARCHRAPHIC instead of VARCHAR

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •