ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ProceTest

ProceTest

原创 Linux操作系统 作者:huangjt007 时间:2012-03-26 17:20:12 0 删除 编辑

 

long li_orno,li_sum
string ls_info
string ls_return
 DECLARE pro_test PROCEDURE FOR 'ProceTest';
// messagebox("info",ls_info)

   
//此处开始执行存储过程
  execute  pro_test;
  messagebox("SQLCA.sqlcode",SQLCA.sqlcode)
//    messagebox("ls_return",ls_return)
// //判断执行结果
CHOOSE CASE SQLCA.sqlcode
CASE 0
       //如果返回0则表示执行成功,至少存在一个SELECT结果集
       //借助LOOP循环开始捕获这个SELECT结果集

       DO
            FETCH pro_test INTO :ls_info,:li_sum ;
            CHOOSE CASE SQLCA.sqlcode
            CASE 0
     messagebox("info",ls_info)
     messagebox("return",li_sum)
              CASE 100
                 MessageBox ("End of Result Set",  " rows fetched")
              CASE -1
                 MessageBox ("Fetch Failed",string (SQLCA.sqldbcode)+ " = " +SQLCA.sqlerrtext)
               END CHOOSE
       LOOP WHILE SQLCA.sqlcode = 0
end choose

   

 

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

 

 


-- =============================================
-- Author:  Sidney
-- ALTER  date: 2010-10-16
-- Description: 读取用户信息
-- =============================================
ALTER  PROCEDURE [dbo].[ProceTest]
AS
BEGIN
SET NOCOUNT off
declare @as_info char(500)
declare @as_sum int
declare @ls_xm char(20)
declare @ls_zh char(20)

DECLARE t_user_Cursor CURSOR FOR
SELECT f_xm,f_zh
FROM t_user
OPEN t_user_Cursor
FETCH NEXT FROM t_user_Cursor
into @ls_xm,@ls_zh
WHILE @@FETCH_STATUS = 0
BEGIN
    print @ls_xm
    print @ls_zh
    FETCH NEXT  FROM t_user_Cursor into @ls_xm,@ls_zh
END

CLOSE t_user_Cursor
DEALLOCATE t_user_Cursor


select @as_info=f_xm,@as_sum=1  from t_user;
select 'test ok!' as f_xm,1 as sum
--select @as_sum=count(*) from t_user
--union

 
END


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/75527/viewspace-719572/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Hn_SellPrize_20110101
下一篇: 东风雪铁龙车
请登录后发表评论 登录
全部评论

注册时间:2012-01-31

  • 博文量
    39
  • 访问量
    18617