when insert persian character in oracle db i see the question mark

后端 未结 2 1395
野性不改
野性不改 2020-12-03 20:18

I use the oracle with c#, i insert embedded in c# code , and my column(NVARCHAR2) and use N \'string\'. when insert in my machine that\'s correct and OK, but when run my app

相关标签:
2条回答
  • 2020-12-03 20:56

    When you say you run on the server, you mean through SQL*Plus?

    First thing to check is what actual character is being stored - use the DUMP function to check this:

    Oracle Dump Function

    This will tell you what is actually stored. If the chain between your client app and Oracle server is not appropriate you might get character set conversion occurring.

    Assuming the correct character is being saved, what you then see on the server / sqlplus is character conversion on display. I.e. Oracle is "serving up" the character correctly, but the display is not handling it as you expect. To fix this, you need to set the NLS_LANG environment variable to the correct character set.

    e.g., in a recent project the default:

    set NLS_LANG=AMERICAN_AMERICA.US7ASCII
    

    then query some data gave:

    NAME
    -----------------------------------
    MS ELLIE MARTALL
    

    But:

    set NLS_LANG=AMERICAN_AMERICA.US8PC437
    

    Then running the query gave:

    NAME
    -----------------------------------
    MS ÉLLIE MARTALL
    

    And also:

    set NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P15
    

    gave:

    NAME
    -----------------------------------
    MS ╔LLIE MARTALL
    

    The key thing here is the actual data is the same, it's the way that data is being presented on your display is what differs, and that behavior can be controlled by NLS_LANG.

    0 讨论(0)
  • 2020-12-03 21:16

    in system variable enviroment I add NLS_LANG=AMERICAN_AMERICA.US8PC437 and my problem it's correct!

    0 讨论(0)
提交回复
热议问题