from #tmpOrgSVDetlList
where OrgID=@intOrgID and SNO<=(@intPage+1)*@intPageCount
and SNO>@intPageCount*@intPage
set @intPage=@intPage+1
end
IF OBJECT_ID(N'tempdb..#tmpOrgSVDetlList', 'U') IS NOT NULL
drop table #tmpOrgSVDetlList
END TRY
BEGIN CATCH
END CATCH
FETCH NEXT FROM WS400_Cursor INTO @intOrgID
END
CLOSE WS400_Cursor
DEALLOCATE WS400_Cursor
IF OBJECT_ID(N'tempdb..#tmpOrgList', 'U') IS NOT NULL
drop table #tmpOrgList
IF OBJECT_ID(N'tempdb..#tmpSVDetlList', 'U') IS NOT NULL
drop table #tmpSVDetlList