저장 프로 세 스 sybase 테이프 입 출력 매개 변수 와 커서 기능

1342 단어 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_itemnumber
go

/*        orderno ,      @oc_list*/
create procedure p_get_oclist_with_itemnumber
(@orderno varchar(30),@oc_list varchar(255) output)
as
declare  @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 cursor1
end
go


/*          */
declare @findword char(255) -- define output param ofindword
declare @no char(30)
select  @no='JH 0902008'

/*   SQL             */
execute p_get_oclist_with_itemnumber  @no,@findword output
go
 
/*      :E0800120 E0800130*/

좋은 웹페이지 즐겨찾기