Creating a stored procedure: setting the character set and collation

后端 未结 2 946
慢半拍i
慢半拍i 2021-02-04 07:31

When creating a MySQL stored procedure how does one set the character set and collation? The MySQL documentation does not provide any examples and to the general syntax is sligh

相关标签:
2条回答
  • 2021-02-04 07:56

    omg omg omg

    character_set_client is the session value of the character_set_client system variable when the routine was created. collation_connection is the session value of the collation_connection system variable when the routine was created. Database Collation is the collation of the database with which the routine is associated. These columns were added in MySQL 5.1.21.

    http://dev.mysql.com/doc/refman/5.1/en/show-procedure-status.html

    In short, open a mysql command line, type in

    SET NAMES UTF8;
    

    then drop and reimport the stored procedures. This fixed my problem. I don't even want to think about pre 5.1.21 users. They are fumbling in the dark!

    0 讨论(0)
  • 2021-02-04 07:56

    Pay attantion to the bugreport. It shows that procedure and its parameters are not assotiated with default character set of the database, but alwais with Binary String.

    So you have to explicitly specify Character set attribute for parameters.

    Simple recreate procedure might not solve the problem.

    0 讨论(0)
提交回复
热议问题