Oracle 5.0 Reference Manual page 797

Table of Contents

Advertisement

• What character set should the server translate a statement to after receiving it?
For this, the server uses the
collation_connection
character_set_client
literals that have an introducer such as
is important for comparisons of literal strings. For comparisons of strings with column values,
collation_connection
has a higher collation precedence.
• What character set should the server translate to before shipping result sets back to the client?
The
character_set_results
server returns query results to the client. This includes result data such as column values, and result
metadata such as column names.
Clients can fine-tune the settings for these variables, or depend on the defaults (in which case, you can
skip the rest of this section). If you do not use the defaults, you must change the character settings for
each connection to the server.
Two statements affect the connection-related character set variables as a group:
SET NAMES 'charset_name' [COLLATE 'collation_name']
indicates what character set the client will use to send SQL statements to the server.
SET NAMES
Thus,
SET NAMES 'cp1251'
character set cp1251." It also specifies the character set that the server should use for sending
results back to the client. (For example, it indicates what character set to use for column values if you
use a
statement.)
SELECT
A
SET NAMES 'charset_name'
SET character_set_client = charset_name;
SET character_set_results = charset_name;
SET character_set_connection = charset_name;
Setting
character_set_connection
collation_connection
that collation explicitly. To specify a particular collation, use the optional
SET NAMES 'charset_name' COLLATE 'collation_name'
SET CHARACTER SET charset_name
SET CHARACTER SET
and
collation_connection
collation_database
these three statements:
SET character_set_client = charset_name;
SET character_set_results = charset_name;
SET collation_connection = @@collation_database;
Setting
collation_connection
to the character set associated with the collation (equivalent to executing
character_set_connection =
character_set_connection
Note
ucs2
work for
Connection Character Sets and Collations
character_set_connection
[443]
system variables. It converts statements sent by the client from
[441]
to
character_set_connection
_latin1
[443]
does not matter because columns have their own collation, which
[443]
system variable indicates the character set in which the
tells the server, "future incoming messages from this client are in
statement is equivalent to these three statements:
[442]
[443]
to the default collation for charset_name. It is unnecessary to set
is similar to
SET NAMES
[443]
to
character_set_database
[444]. A
SET CHARACTER SET charset_name
[443]
also implicitly sets
@@character_set_database). It is unnecessary to set
[442]
explicitly.
cannot be used as a client character set, which means that it does not
or
SET NAMES
SET CHARACTER
777
[442]
and
[442]
or _utf8).
collation_connection
to
also implicitly sets
charset_name
but sets
character_set_connection
character_set_connection
SET.
(except for string
[443]
clause:
COLLATE
[442]
[442]
and
statement is equivalent to
[442]
SET

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents