1. The table definition is a character type, and an int is passed in
2. Character set inconsistency. The field defined by the table is GBK, which is passed into the UTF8; This occurs more in the stored procedure.
The character set of the database UTF8
Mysql> Show CREATE Database jstmonitor;
+------------+---------------------------------------------------------------------+
| Database | Create Database |
+------------+---------------------------------------------------------------------+
| Jstmonitor | CREATE DATABASE ' jstmonitor '/*!40100 DEFAULT CHARACTER SET UTF8 */| |
+------------+---------------------------------------------------------------------+
1 row in Set (0.00 sec)
The character set of the table GBK
Mysql> Show CREATE TABLE T1\g
1. Row ***************************
Table:t1
Create table:create Table ' T1 ' (
' col1 ' varchar () not NULL,
' Col2 ' bigint (one) not NULL DEFAULT ' 0 ',
PRIMARY KEY (' col1 ')
) Engine=innodb DEFAULT CHARSET=GBK
1 row in Set (0.00 sec)
A stored procedure was created:
Mysql> Show CREATE PROCEDURE Proc1\g
1. Row ***************************
Procedure:proc1
Sql_mode:
Create procedure:create definer= ' root ' @ ' 127.0.0.1 ' Procedure ' proc1 ' (in isn CHAR (20))
BEGIN
START TRANSACTION;
SELECT col2 from T1 WHERE col1= isn for UPDATE;
COMMIT;
END
Character_set_client:latin1
Collation_connection:latin1_swedish_ci
Database Collation:utf8_general_ci
1 row in Set (0.00 sec)
Calling the stored procedure: Call Proc1 (' tr ');
Show Processlist See the result:
| 878794 | Root | 127.0.0.1:43746 | Jstmonitor | Query | 10 | Waiting for table level lock | SELECT col2 from T1 WHERE col1= name_const (' isn ', _utf8 ' tr ' COLLATE ' utf8_general_ci ') for UPDATE | 0 | 0 | 1 |
The input column of the stored procedure requires an explicit definition of the input character set, otherwise the character set of its input column inherits from the library's character set.
If the library's character set and the field's character set are inconsistent, an implicit conversion occurs.
3. When multiple tables are associated, the character set of the associated fields is inconsistent;
Several implicit conversions of MySQL