存储过程sybase带输入输出参数和游标功能
??? 例子:
/**带输入输出参数和游标功能的sybase存储过程 *author:chinayaosir *blog: http://blog.csdn.net/chinayaosir *qq group: 34610648: *qq NO:44633197 *test tools:Sybase sql advantage*/drop procedure p_get_oclist_with_itemnumbergo/* 定义输入参数 orderno , 输出参数 @oc_list*/create procedure p_get_oclist_with_itemnumber(@orderno varchar(30),@oc_list varchar(255) output)asdeclare @oc varchar(30)declare @oclist varchar(30)begin declare cursor1 cursor for select distinct oc_number from p_package_oa where order_no=@orderno open cursor1 fetch cursor1 into @oc while @@sqlstatus = 0 begin select @oclist=@oclist+@oc fetch cursor1 into @oc end select @oc_list=@oclist close cursor1endgo/* 定义输入输出参数 */declare @findword char(255) -- define output param ofindworddeclare @no char(30)select @no='JH 0902008'/* 在 SQL 后台运行此存储过程测试 */execute p_get_oclist_with_itemnumber @no,@findword outputgo /* 运行结果 :E0800120 E0800130*/
?