sybase存储过程问题

[ 来源: | 作者: | 时间:2007-07-21 | 收藏 | 推荐 ] 【

  问:SYBASE存储过程,为什么执行到这一句就不执行了 http://www.it55.com/

select @nSerialNo = serialno from schedule where phonenum= @strPhoneNum and type = @nType
if @@rowcount = 0
begin
...
end
else
begin
...
end

  上面的select结果是空记录集,存储过程一执行到空记录集,就会返回?

免费资源www.it55.com

  答:if exists(select @nSerialNo = serialno from schedule where phonenum= @strPhoneNum and type = @nType)这个语句的逻辑有点问题?

www.it55.com

  if exists 一般是用来确定是否存在类似的记录?你现在又要将存在的结果赋值?其实还不如写 if exists(select 1 from schedule where phonenum= @strPhoneNum and type = @nType)

45398 www.it55.com it55学习IT知识,享受IT生活 4dfkjn

  确定是否存在这样的记录,在执行相应的处理。

免费资源www.it55.com

it55.com

(编辑:IT资讯之家 www.it55.com

返回顶部
 

网友评论

[以下评论为网友观点,不代表本站。请自觉遵守互联网相关政策法规,所有连带责任均有评论者自负。]
[不超过250字]