mysql 存储过程,第一个变量就报错,为什么.
DELIMITER//CREATEPROCEDUREhualDECLARE@hualxavarchar(20)DECLARE@hualxbvarchar(20)DECLA...
DELIMITER //
CREATE PROCEDURE hual
DECLARE @hualxa varchar(20)
DECLARE @hualxb varchar(20)
DECLARE @hualxc varchar(20)
DECLARE @huald varchar(20)
DECLARE @huale varchar(20)
DECLARE @hualf varchar(20)
begin
select @huald=(select maca from radcheck where username=@hualxb)
select @huale=(select macb from radcheck where username=@hualxb)
select @hualf=(select macc from radcheck where username=@hualxb)
if((@hualxc == 'Access-Reject') and (@huald='a') ) then
update radcheck set maca=@hualxa where username=@hualxb and maca='a';
else
if((@hualxc == 'Access-Reject') and (@huale='a') ) then
update radcheck set macb=@hualxa where username=@hualxb and macb='a';
else
if((@hualxc == 'Access-Reject') and (@hualf='a') ) then
update radcheck set macc=@hualxa where username=@hualxb and macc='a';
else
end;
end
//
DELIMITER;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hualxa varchar
@hualxb varchar
@hualxc varchar
as
begin
declare @huald varcha' at line 3
mysql>
mysql> DELIMITER;
******************************************************************* 展开
CREATE PROCEDURE hual
DECLARE @hualxa varchar(20)
DECLARE @hualxb varchar(20)
DECLARE @hualxc varchar(20)
DECLARE @huald varchar(20)
DECLARE @huale varchar(20)
DECLARE @hualf varchar(20)
begin
select @huald=(select maca from radcheck where username=@hualxb)
select @huale=(select macb from radcheck where username=@hualxb)
select @hualf=(select macc from radcheck where username=@hualxb)
if((@hualxc == 'Access-Reject') and (@huald='a') ) then
update radcheck set maca=@hualxa where username=@hualxb and maca='a';
else
if((@hualxc == 'Access-Reject') and (@huale='a') ) then
update radcheck set macb=@hualxa where username=@hualxb and macb='a';
else
if((@hualxc == 'Access-Reject') and (@hualf='a') ) then
update radcheck set macc=@hualxa where username=@hualxb and macc='a';
else
end;
end
//
DELIMITER;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hualxa varchar
@hualxb varchar
@hualxc varchar
as
begin
declare @huald varcha' at line 3
mysql>
mysql> DELIMITER;
******************************************************************* 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询