Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert chinese charaters in Rdb database via DCL

 
Toine_1
Regular Advisor

How to insert chinese charaters in Rdb database via DCL

Hello,

Is it possible to insert chinese charaters into to an Rdb table via a sql script which is started via DCL.

Example:

sql> show table1;

Information for table TABLE1

Columns for table TABLE1:
Column Name Data Type Domain
----------- --------- ------
UTFCOL CHAR(300)
UTF8 100 Characters, 300 Octets

sql> Insert into table1 values ('控制');

How can I do this?

Or should I use something like this:

sql> insert into table1 values(translate(hex42424 using rdb$utf8);

All examples are welcome.


/Toine
5 REPLIES 5
Ph Vouters
Valued Contributor

Re: How to insert chinese charaters in Rdb database via DCL

This kind of aspect within RDB/SQL is addressed by such a document I
found on the Web specifically dealing with RDB/VMS and written at
DEC's times. Here is its URL
http://www.hpl.hp.com/hpjournal/dtj/vol5num3/vol5num3art7.pdf

The Oracle RDB/VMS Release Notes 7.1.4.1 mentions a problem with
GB18030 or UTF8 character sets which has been corrected. This is
described in the document at
http://download.oracle.com/otn_hosted_doc/rdb/pdf/rdbrn_7141.pdf in
section 2.2.12.

However all these technics uses a 7 bit ASCII terminal. So with all
the information read in mind, I assume one of the correct RDB syntax
is for your example:
SQL> insert into table1 values (_UFT8 X'42424')
Ph Vouters
Valued Contributor

Re: How to insert chinese charaters in Rdb database via DCL

Dear Toine,

To complement my previous answer you ought to be able to define your table column as:
NAME CHARACTER VARYING ()
CHARACTER SET IS UTF8,

Provided sql$ handles locales, you might set the locale as one of the Chinese UTF8 VMS locale with the $ define LANG and then
$ run sql$
SQL> Insert into table1 values ('æ §å ¶');

Of course and if cutting and pasting information, your terminal must be UTF8 capable. For more information about terminals, read my reply to Boris at http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1465316

Yours sincerely,
Philippe
Ph Vouters
Valued Contributor

Re: How to insert chinese charaters in Rdb database via DCL

Toine,

To correct my previous reply and if I refer to the first document, the correct SQL syntax would be using an UTF8 capable terminal:
SQL> Insert into table1 values (_UTF8'')

Of course the column must be declared as CHARACTER SET IS UTF8

Deeply sorry for the confusion.
Philippe
Ph Vouters
Valued Contributor

Re: How to insert chinese charaters in Rdb database via DCL

Toine,

sql$ is only sys$language logical sensitive. You may define it in your process logical name table. sql$ starts up correctly with ENGLISH, SWEDISH and HANZI. However you must own the appropriate keyboard to enter Swedish or Chinese characters into sql$.

I checked this below with sys$language set to English:
$ sql$
SQL> create database filename sys$login:test.rdb;
SQL> create table employees ( name char(300) character set utf8);
SQL> insert into employees values('philippe');
%SQL-F-INCCSASS, Incompatible character set assignment between NAME and
SQL> insert into employees value(_UTF8'philippe');
1 row inserted
SQL> insert into employees values (_UTF8 X'42424');
%SQL-F-HEXSTREVE, A hexadecimal string must have an even number of digits
SQL> insert into employees values (_UTF8 X'042424');
1 row inserted
SQL> select * from employees
cont> ;

NAME
philippe
>>
>>
>>
$$
>>
>>
>>
2 rows selected
SQL> quit

Ph Vouters
Valued Contributor

Re: How to insert chinese charaters in Rdb database via DCL