Recently learned about MySQL stored procedures, the previous version of MySQL does not support stored procedures, 5.0 version can support the use of stored procedures, just the author download using version 5.6.20:
Made a simple stored procedure for inserting data into a table, and found that Chinese characters are all displayed after opening the table. No. As follows:
So the internet to check the information, busy two hours before the fix! All right, now let's take a brief look.
The problem that I met is caused by two kinds of reasons;
First: Using the NAVICAT database client to establish table setup problems is caused by the following:
After the top operation is finished, you can insert Chinese characters in the table, no? Number or garbled phenomenon, this thought the problem solved, but the use of stored procedures is still inserted? And then I think it is a stored procedure problem, sure enough, after the data found that the MySQL stored procedure insert parameters involved in Chinese to change the varchar type to nvarchar, the code is as follows:
All right, finish the call! The results are as follows:
The above method is the two problems I found, and the solution, such as readers have other better solutions, can also be proposed, mutual progress, of course, similar problems may be caused by other reasons, here is not too much to describe!
When MySQL uses stored procedures to insert data, the parameter is in Chinese? or garbled