当前位置:论坛首页 > Linux面板 > 求助

【已解答】宝塔上搭的mysql运行不了存储过程

发表在 Linux面板2021-3-12 11:51 [复制链接] 9 2158

用宝塔创建数据库 结果把之前的数据库顶掉了,然后目前卡在那个数据库跑不了我们本来的存储过程,现在还不知道是为什么,但是我们软件还要运行数据库里的存储过程的。然后我复制原来的存储过程写进去,但是运行不了,现在就是宝塔上搭的mysql运行不了存储过程,存储过程代码应该没问题的

DROP PROCEDURE IF EXISTS `logon`;
CREATE DEFINER = `duojiaadmin`@`%` PROCEDURE `logon`(in in_username text ,in in_pass text)
BEGIN
#Routine body goes here...
DECLARE t_ver text;
DECLARE t_code int;
DECLARE t_kjgn text;
DECLARE t_parts text;
DECLARE t_normal text;
DECLARE t_super text;
DECLARE t_permission text;
set t_code=0;
select code,kjgn,permission,userpart into t_code,t_kjgn,t_permission,t_parts from userlogon
where username=in_username and pass1=password(in_pass);
if t_code=0 THEN
select 0 as t_ver;
else
call splitstring(t_permission,',');
select group_concat(部门) into t_normal from 权限 where id in (select val_ from tmp_split);
select group_concat(部门) into t_super from 权限 where instr(职务,'经理')>0 AND
id in (select val_ from tmp_split);
select pass1 into t_ver from userlogon where username='version';
select t_ver,t_code,t_kjgn,t_parts,t_normal,t_super,t_permission;
end if;
END;


这是运行代码
使用道具 举报 只看该作者 回复
发表于 2021-3-12 14:46:35 | 显示全部楼层
数据库报错提示
报错.png
使用道具 举报 回复 支持 反对
发表于 2021-3-12 14:54:16 | 显示全部楼层

您好,1064是sql语句语法错误,1193错误是系统变量问题。自己检查一下自己sql语句语法。
使用道具 举报 回复 支持 反对
发表于 2021-3-12 15:10:34 | 显示全部楼层
DROP PROCEDURE IF EXISTS `logon`;
CREATE DEFINER = `duojiaadmin`@`%` PROCEDURE `logon`(in in_username text ,in in_pass text)
BEGIN
        #Routine body goes here...
DECLARE t_ver text;
DECLARE t_code int;
DECLARE t_kjgn text;
DECLARE t_parts text;
DECLARE t_normal text;
DECLARE t_super text;
DECLARE t_permission text;
set t_code=0;
select code,kjgn,permission,userpart into t_code,t_kjgn,t_permission,t_parts from userlogon
where username=in_username and pass1=password(in_pass);
if t_code=0 THEN
select 0 as t_ver;
else
call splitstring(t_permission,',');
select group_concat(部门) into t_normal from 权限 where id in (select val_ from tmp_split);
select group_concat(部门) into t_super from 权限 where instr(职务,'经理')>0 AND
id in (select val_ from tmp_split);
select pass1 into t_ver from userlogon where username='version';
select t_ver,t_code,t_kjgn,t_parts,t_normal,t_super,t_permission;
end if;
END;

这个语法有什么问题吗
使用道具 举报 回复 支持 反对
发表于 2021-3-12 15:13:53 | 显示全部楼层

DROP PROCEDURE IF EXISTS `logon`;
CREATE DEFINER = `duojiaadmin`@`%` PROCEDURE `logon`(in in_username text ,in in_pass text)
BEGIN
        #Routine body goes here...
DECLARE t_ver text;
DECLARE t_code int;
DECLARE t_kjgn text;
DECLARE t_parts text;
DECLARE t_normal text;
DECLARE t_super text;
DECLARE t_permission text;
set t_code=0;
select code,kjgn,permission,userpart into t_code,t_kjgn,t_permission,t_parts from userlogon
where username=in_username and pass1=password(in_pass);
if t_code=0 THEN
select 0 as t_ver;
else
call splitstring(t_permission,',');
select group_concat(部门) into t_normal from 权限 where id in (select val_ from tmp_split);
select group_concat(部门) into t_super from 权限 where instr(职务,'经理')>0 AND
id in (select val_ from tmp_split);
select pass1 into t_ver from userlogon where username='version';
select t_ver,t_code,t_kjgn,t_parts,t_normal,t_super,t_permission;
end if;
END;

这个语法有什么问题吗
使用道具 举报 回复 支持 反对
发表于 2021-3-12 15:20:33 | 显示全部楼层
这个语句原本哪里拷贝来的,现在以前那个运行不了。放到宝塔上来跑。这个sql具体哪里错了?不然在宝塔上也跑不了
使用道具 举报 回复 支持 反对
发表于 2021-3-12 16:03:16 | 显示全部楼层
剧LOL终 发表于 2021-3-12 15:13
DROP PROCEDURE IF EXISTS `logon`;
CREATE DEFINER = `duojiaadmin`@`%` PROCEDURE `logon`(in in_usern ...

提示sql语句错误在第4行和第1行
使用道具 举报 回复 支持 反对
发表于 2021-3-12 16:16:22 | 显示全部楼层
这个怎么修改呢 我也不懂这个
使用道具 举报 回复 支持 反对
发表于 2021-3-13 09:56:49 | 显示全部楼层
谢花郎 发表于 2021-3-12 16:03
提示sql语句错误在第4行和第1行

这个怎么修改呢 我也不懂这个
使用道具 举报 回复 支持 反对
发表于 2021-3-13 11:35:56 | 显示全部楼层
剧LOL终 发表于 2021-3-13 09:56
这个怎么修改呢 我也不懂这个

复制这个语句,到phpmyadmin 中选择你要执行这个存储过程的数据库,没有存储过程的话,就先新建一个,你复制到mysql命令行中有些换行、空格有时候会被识别成Enter键,导致你后面的语句无法执行
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表