How to save unicode data to oracle?

前端 未结 6 1157
轮回少年
轮回少年 2020-12-18 04:02

I am trying to save unicode data (greek) in oracle database (10 g). I have created a simple table:

I understand that NVARCHAR2 always uses UTF-16 encoding

6条回答
  •  我在风中等你
    2020-12-18 04:51

    You can determine what characterset your database uses for NCHAR with the query:

    SQL> SELECT VALUE
      2    FROM nls_database_parameters
      3   WHERE parameter = 'NLS_NCHAR_CHARACTERSET';
    
    VALUE
    ------------
    AL16UTF16
    

    to check if your database configuration is correct, you could run the following in SQL*Plus:

    SQL> CREATE TABLE unicodedata (ID NUMBER, unicodestring NVARCHAR2(100)); 
    
    Table created
    SQL> INSERT INTO unicodedata VALUES (11, 'Τι κάνεις;');
    
    1 row inserted
    SQL> SELECT * FROM unicodedata;
    
            ID UNICODESTRING
    ---------- ---------------------------------------------------
            11 Τι κάνεις;
    

提交回复
热议问题