How to insert obscure words in ORACLE database
This article is from the official oracle blog. The character set of many customers' database is ZHS16GBK, but some special obscure words are not included in this character set. Here is an example of how to insert these two characters into the database.
1. Description:
The nls_characterset of the database is ZHS16GBK, and NLS_NCHAR_CHARACTERSET is AL16UTF16.
The tool used to insert data is sqldeveloper, and the corresponding version is 4.2.0.17.089
two。 Query the Unicode code of these two words
There are many Unicode-related websites on the Internet, and the Unicode codes corresponding to these two words can be found through the relevant websites:
Encoding Unicode: 4DAE
Encoding Unicode: 3F06
3. Create a test table
Create table test (name nvarchar2 (30))
4. Insert data
SQL > insert into test values (N'roomgirls')
Must be prefixed with the letter "N", otherwise the inserted data is still garbled!
SQL > commit
5. Validate data
SQL > select name,dump (name,1016) b from test
NAME B
Beautiful Typ=1 Len=4 CharacterSet=AL16UTF16: 4dpenny aepene 3fjingle 6
The word "notify" has been successfully inserted into the table and can be displayed correctly. The corresponding Unicode code is 4d _ 6, which is consistent with the result of the query in the first step.
Related references:
The National Character Set (NLS_NCHAR_CHARACTERSET) in Oracle 9i, 10g, 11g and 12c (Doc ID 276914.1)