给你个例子,我程序的一个片段 PROCEDURE rkqx (v_dhbh in number)IS/*入库取消*/ v_rkdh varchar2(20); i number; v_htbh varchar2(30); str varchar2(2000); cursor b is select distinct llbh from dbcb_ll where rkdh=v_rkdh and jssj is not null; BEGIN /*检验是否已经领料*/ select count(*) into i from dbcb_ll where rkdh=v_rkdh and jssj is not null; if i>0 then open b; fetch b into i; while b %found loop str:=str||','||to_char(i); fetch b into i; end loop; close b; alertok('此入库单已经领料,对应的领料单包括:'||substr(str,2)); raise form_trigger_failure; end if; commit; END;
PROCEDURE rkqx (v_dhbh in number)IS/*入库取消*/
v_rkdh varchar2(20);
i number;
v_htbh varchar2(30);
str varchar2(2000);
cursor b is select distinct llbh from dbcb_ll where rkdh=v_rkdh and jssj is not null;
BEGIN
/*检验是否已经领料*/
select count(*) into i from dbcb_ll where rkdh=v_rkdh and jssj is not null;
if i>0 then
open b;
fetch b into i;
while b %found loop
str:=str||','||to_char(i);
fetch b into i;
end loop;
close b;
alertok('此入库单已经领料,对应的领料单包括:'||substr(str,2));
raise form_trigger_failure;
end if;
commit;
END;