日期:2014-05-17  浏览次数:20890 次

Sybase查询求教.....急急急.....
在SYBASE中如何实现递归查询
例如ORACLE中的 start by .... connect by 



------解决方案--------------------
CREATE procedure bitGetsaltSort (
 @saltSort nvarchar( 50 ), --查询的盐种名称
 @wcis_00802 nvarchar( 50 ), --盐父类编号
 @result bit output
)
 AS
declare @w00802 nvarchar(50),@w00803 nvarchar(50)
select @w00802 = (SELECT WCIS_00802 FROM WCISTA_008 WHERE WCIS_00801 = @wcis_00802),
 @w00803 = (SELECT WCIS_00803 FROM WCISTA_008 WHERE WCIS_00801 = @wcis_00802)
 
IF @w00802 = '0'
 begin
select @result = 0
 end
else
 if @w00803 = @saltSort
begin
select @result = 1
end
else
 begin
execute bitGetsaltSort @saltSort,@w00802,@result output
 end
------解决方案--------------------
http://www.2cto.com/database/201203/124955.html