2

I want to insert UTF-8 characters in Oracle 12 database using INSERT statement. I'm using PL/SQL Developer Tool (version 8).

When I run this INSERT statement

INSERT INTO my_table (my_column) VALUES ('ტექსტი');

and then run the SELECT statement

SELECT my_column FROM my_table

it returns question marsk

??????

But when I insert my UTF-8 text manually (using copy & paste) into the table and then run the same SELECT statement it returns data correctly

ტესქტი

Should I run any command before inserting UTF-8 character using insert statement?

JiboOne
  • 1,438
  • 4
  • 22
  • 55
  • 2
    Please run `select * from nls_database_parameters where parameter like '%SET%';` and append a result of this query to your question. I guess that `INSERT INTO my_table (my_column) VALUES (N'ტექსტი');` shoud give a result you want (just add a prefix N before text literal). – krokodilko Aug 07 '17 at 16:49

1 Answers1

8

Prefix your string literal with n as in

INSERT INTO my_table (my_column) VALUES (n'ტექსტი');

That will tell your Oracle DB that the incoming value is of nvarchar2 data type.

peter.hrasko.sk
  • 4,043
  • 2
  • 19
  • 34