请问:PB怎么接收这类存储过程的返回值啊

hopefire 2005-07-19 11:01:22
create PROCEDURE up_item_status
@instrument_id char(3),
@item_symbolic varchar(10)
AS
if exists(
select 'X' from lab_item
where lab_instrument_id = @instrument_id
and lab_item_symbolic = @item_symbolic )
return 1
else
return 0

PB怎么调用才能得到返回的值(0或1)呢

declare up_test PROCEDURE for up_item_status
@instrument_id=:ls_instrument_id,@symbolic=:ls_item
;
EXECUTE up_test;//返回sqlca.sqlcacode=100
fetch up_test into :ls_return;//提示Cursor is not open
close up_test;
最终不能得到存储过程返回的值
...全文
202 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wscft 2005-07-20
  • 打赏
  • 举报
回复
integer ls_return

ls_return Execute = up_test //这样对不对呢?楼主可以试一试·
liqunen 2005-07-20
  • 打赏
  • 举报
回复
create PROCEDURE up_item_status
@instrument_id char(3),
@item_symbolic varchar(10)
AS
declare @r int
if exists(
select 'X' from lab_item
where lab_instrument_id = @instrument_id
and lab_item_symbolic = @item_symbolic )
set @r=1
else
set @r=0
select @r
-----------------------------------------------------
declare up_test PROCEDURE for up_item_status
@instrument_id=:ls_instrument_id,@symbolic=:ls_item
;
EXECUTE up_test;
fetch up_test into :ls_return
if qlca.sqlcacode<>0 then
close up_test;
return
end if
close up_test;
jlwei888 2005-07-20
  • 打赏
  • 举报
回复
定义一个输出参数
create PROCEDURE up_item_status
@instrument_id char(3),
@item_symbolic varchar(10) ,
@outdata int output;
AS
if exists(
select 'X' from lab_item
where lab_instrument_id = @instrument_id
and lab_item_symbolic = @item_symbolic )
outdata = 1
else
outdata = 0



754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧