您当前的位置:中客资源站网络学院数据库类SYBASE → 文章内容 退出登录 用户管理
本类热门文章
相关下载
sybase存储过程问题
作者:中客资源  来源:中客资源  发布时间:2007-2-9 1:56:31

减小字体 增大字体

问: SYBASE存储过程,为什么执行到这一句就不执行了 
select @nSerialNo = serialno from schedule where phonenum= @strPhoneNum and type = @nType 
if @@rowcount = 0 
begin 
... 
end 
else 
begin 
... 
end 
上面的select结果是空记录集,存储过程一执行到空记录集,就会返回?

答:if exists(select @nSerialNo = serialno from schedule where phonenum= @strPhoneNum and type = @nType)这个语句的逻辑有点问题? 
if exists 一般是用来确定是否存在类似的记录?你现在又要将存在的结果赋值?其实还不如写 if exists(select 1 from schedule where phonenum= @strPhoneNum and type = @nType) 
确定是否存在这样的记录,在执行相应的处理。
[] [返回上一页] [打 印]
文章评论 (评论内容只代表网友观点,与本站立场无关!)

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码