Menu

ORA-01406

2010-05-28
2012-09-26
  • Nobody/Anonymous

    Hello.

    My application returns an ORA-01406 when i try to execute OCI_FetchNext(rs)
    function.
    Here the part of C code:

    OCI_ExecuteStmt(st, "select * from zep_v_zw");
        rs = OCI_GetResultset(st);
        while(OCI_FetchNext(rs)) {
            printw("%s  %s  %s  %s\n", OCI_GetString(rs, 1),
                    OCI_GetString(rs, 2), OCI_GetString(rs, 3),
                    OCI_GetString(rs, 4));
        }
    

    And view code:

    SELECT
        lpad(num, 5, ' ') num,
        rpad(code, 4, ' ') code,
        TO_CHAR(idate, 'DD-MM-YY') idate,
        rpad(info, 75, ' ') info
    FROM
        zw
    WHERE
        status <> 'Z'
        AND code IN ( 'P', 'A' )
        AND idate > ADD_MONTHS(TRUNC(SYSDATE, 'DD'), -2)
    ORDER BY num DESC, code
    

    There's a problem with

    rpad(info, 75, ' ') info
    

    line.
    Without rpad() everything is fine. Info column is 500 bytes long in
    table.

    Database version 9i Release 9.2.0.6.0
    Client: Instant Client 11.2.0.1
    Ocilib version: 3.5.1
    OS: Debian 5.0.4 x86

    Any suggestions?

     
  • Vincent Rogier

    Vincent Rogier - 2010-05-28

    Hi,

    It migth be an oracle bug (found something similar in metalink bug database).

    I'll test it on my config this afternoon and let you know.

     
  • Vincent Rogier

    Vincent Rogier - 2010-05-28

    hi,

    i've just tried it on my local config (10gR2 client and server).
    I created the same view (mapped to one of my tables where num and code are
    varchar2(15), idate a date and info varchar2(200).

    Is your database charset UTF8 ?

    I build the test suite in ANSI charset and no error.

     
  • Nobody/Anonymous

    No, it's EE8ISO8859P2

     
  • Nobody/Anonymous

    When I unset NLS_LANG (I'm using POLISH_POLAND.UTF8 value) there's no error
    anymore, but there's no polish letters.

     
  • Vincent Rogier

    Vincent Rogier - 2010-05-28

    Ok, you're using UTF8 as client charset. So you need to use ocilib v3.6.0 that
    has proper support for UTF8

     
  • Nobody/Anonymous

    With v3.6.0 it works like a charm :)

    Thank you very much!

     
  • Vincent Rogier

    Vincent Rogier - 2010-05-28

    Good :)