mysql存储过程中定义变量提示语法错误,来高手帮看下,在线等待。。。。。。

declare @Node bigint,@Personnel bigint,@Permissions bigint,@LuggageID bigint,@LuggageType bigint,@TargetSite bigint,@TheirCarID bigint,@SourceSite bigint,@SupercargoID bigint,@TransactorID bigint,@MyPersonnelID bigint,@TheirRecordID bigint
set @Node=concat(select ID from datadictionary where Content=MyNode); /*根据网点名称查询*/
set @Personnel=concat(select ID from personnelinformation where StaffName=MyPersonnel); /*根据姓名查询*/
set @Permissions=concat(select ID from datadictionary where Content=MyPermission); /*根据权限查询*/
set @Luggage=concat(select ID from luggageinformation where RFID=(select ID from rfiddictionary CardID=Myluggage));

兄弟你的问题解决了嘛?

declare var1,var2,.... bigint

set @var1 = '';
select col1 into @var2 from tableName;

为什么我这边执行定义变量就报错
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-05-25
你把代码贴出来啊!追问

我叉叉这个网页,他妹的,代码太多了,贴不出来。。
declare @Node bigint,@Personnel bigint,@Permissions bigint,@LuggageID bigint,@LuggageType bigint,@TargetSite bigint,@TheirCarID bigint,@SourceSite bigint,@SupercargoID bigint,@TransactorID bigint,@MyPersonnelID bigint,@TheirRecordID bigint
老是报这点错误。

追答

应该是这样写的吧
不是定义变数错了,应该是对变数的赋值有问题
declare @Node bigint,@Personnel bigint,@Permissions bigint,@LuggageID bigint,@LuggageType bigint,@TargetSite bigint,@TheirCarID bigint,@SourceSite bigint,@SupercargoID bigint,@TransactorID bigint,@MyPersonnelID bigint,@TheirRecordID bigint
declare @Luggage bigint
select @Node=ID from datadictionary where Content=MyNode
select @Personnel=ID from personnelinformation where StaffName=MyPersonnel
select @Permissions=ID from datadictionary where Content=MyPermission
select @Luggage=ID from luggageinformation where RFID in (select ID from rfiddictionary where CardID=Myluggage)

相似回答