u010713523 2013-09-27 06:03
浏览 1099

navcat中创建存储过程遇到的不识别的问题

本人是个菜鸟,在navicat中创建存储过程时遇到的问题

CREATE procedure CountLayer  (in node int,out result int)
begin  
    declare result,lft1, rgt1 int;
    if exists(select Node_id from Tree where Node_id = node); 
    begin 
        select lft1 = Lft,rgt1 = Rgt from Tree where( Node_id = node);
        select result = count(*) from Tree where Lft <= lft1 and Rgt >= rgt1;  
    end  
    return result  
end 
GO

然后错误

[SQL] CREATE procedure CountLayer  (in node int,out result int)
begin  
    declare result,lft1, rgt1 int;
    if exists(select Node_id from Tree where Node_id = node); 
    begin 
        select lft1 = Lft,rgt1 = Rgt from Tree where( Node_id = node);
        select result = count(*) from Tree where Lft <= lft1 and Rgt >= rgt1;  
    end  
    return result  
end 
GO

[Err] 1064 - 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 '; 
    begin 
        select lft1 = Lft,rgt1 = Rgt from Tree where( Node_id = ' at line 4

跪求跪求大神解决。。。

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥15 stable diffusion
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误