Problems with MySQL creating stored procedures

Source: Internet
Author: User

1. After a successful creation of the stored procedure, use the call stored procedure name to execute the Times error:

Illegal mix of collations (utf8_unicode_ci,implicit) and (utf8_general_ci,implicit) errors.

Workaround: Check the encoding of the table used by the stored procedure, including the fields and the table itself. The final unified encoding method. After the type is a character, string, and so on, addCHARSET UTF8Example: DELIMITER $$   USE `mall`$$   DROP PROCEDURE IF EXISTS `Prc_AddArticleInfo`$$   create definer= ' root ' @ ' localhost ' PROCEDURE ' Prc_addarticleinfo ' (snames text CHARSET utf8,contents text CHARSET utf8,createdtimes datetime,,urls TEXT CHARSET utf8, CAGs varchar (32 CHARSET UTF8 ,usernames varchar (32 ) CHARSET utf8) BEGIN DECLARE userids INT DEFAULT 0; DECLARE genreids INT DEFAULT 0; DECLARE sname TEXT CHARSET utf8 DEFAULT NULL; DECLARE scontent TEXT CHARSET utf8 DEFAULT NULL; DECLARE screatedtime TEXT CHARSET utf8 DEFAULT NULL; DECLARE svoidtime TEXT CHARSET utf8 DEFAULT NULL; DECLARE surl TEXT CHARSET utf8 DEFAULT NULL; DECLARE username VARCHAR(32) CHARSET utf8 DEFAULT NULL; DECLARE cag VARCHAR(32) CHARSET utf8 DEFAULT NULL; SET sname=snames; SET scontent=contents; SET screatedtime=createdtimes; SET svoidtime=voidtimes; SET surl=urls; SET username=usernames; SET cag=cags; SELECT id INTO genreids FROM genres WHERE NAME=cag; SELECT admin_user_id INTO userids FROM admin_user WHERE admin_user_name=username; insert into Article (name,content,createdtime,voidtime,url,genreid,userid) Values ( sname,scontent, Screatedtime,svoidtime,surl ,genreids,userids END$$   DELIMITER ;2.mysql report fatal error encountered during command execution solution

In the connection string, add

Allow User variables=true

Solve.

Otherwise, occasionally the error, the stored procedure name is a bit of error, and the Times do not report, the parameters of the 1-digit number of normal 2-digit error, etc...

Problems with MySQL creating stored procedures

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.