SQL命令插入中文字母

问题描述:

我有一个数据库,其中一列的类型为nvarchar.如果我写

I have a database with one column of the type nvarchar. If I write

INSERT INTO table VALUES ("玄真") 

它在表中显示¿¿.我该怎么办?

It shows ¿¿ in the table. What should I do?

我正在使用SQL Developer.

I'm using SQL Developer.

使用单引号而不是双引号来创建文本文字,对于NVARCHAR2/NCHAR文本文字,您需要在其前面加上N

Use single quotes, rather than double quotes, to create a text literal and for a NVARCHAR2/NCHAR text literal you need to prefix it with N

SQL小提琴

Oracle 11g R2架构设置:

CREATE TABLE table_name ( value NVARCHAR2(20) );

INSERT INTO table_name VALUES (N'玄真');

查询1 :

SELECT * FROM table_name

结果 :

Results:

| VALUE |
|-------|
|    玄真 |