思迅软件PDA 3900 BUG 代码:05FF 子查询返回的值不止一个。当子查询跟随在 之后,或子查询用作表达式时

主程序:思迅商锐9.5

PDA 3900 服务端版本 1.1

事件类型:PDA查询报表 查询商品档案时 返回上图错误 

代码:05FF 子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时

经过跟踪分析,发现是由于PDA服务程序代码,有一个BUG

	
	if @item_no='' or  @item_no is  null
	 begin
	  SELECT @as_searchstr  AS item_no, '查询不到商品信息,请重新输入!' AS item_name,@branchNo as branch_no, '' AS item_size, '' AS unit_no,  0.0  as stock_qty
	 end
	else
		SELECT a.item_no,
			   a.item_name,
			   '['+c.branch_no+']'+c.branch_name  as  branch_no,
			   isnull(a.item_size,'') as item_size,
			   isnull(a.unit_no,'')   as unit_no,
			   isnull((select t_im_branch_stock.stock_qty from t_im_branch_stock where t_im_branch_stock.item_no= a.item_no),0)  as stock_qty
		  FROM  t_bd_item_info a     --t_im_branch_stock b
			--inner  join t_bd_item_info a on  a.item_no = b.item_no
			inner  join t_bd_branch_info c on c.branch_no like @branchNo+'%'
		WHERE a.status <> '5' and c .branch_no like  @branchNo+'%'
		  and (a.item_no =@item_no)	 --
end

上述错误代码, 会筛选出大于1的多行记录。故导致整个过程错误。

 isnull((select t_im_branch_stock.stock_qty from t_im_branch_stock where t_im_branch_stock.item_no= a.item_no),0)  as stock_qty

解决方法

isnull((select t_im_branch_stock.stock_qty from t_im_branch_stock where t_im_branch_stock.item_no= a.item_no and branch_no like @branchNo ),0)  as stock_qty

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值