ALTER Proc [dbo].[S_CRM_BUSI_GetUserApps]
@UCode varchar(50)
As
-- 获取用户有权限访问的应用
Declare @AppModel varchar(100)
Declare @NeedShow IntDeclare @Apps Table
(
AppModel varchar(100)
)Declare cur_app Cursor For
Select ObjCode From sys_spec Where sys_spec.objtype = 'app' And isdisonmain = 1OPEN cur_app
FETCH NEXT FROM cur_app INTO @AppModel
WHILE @@FETCH_STATUS = 0
BEGIN
Exec S_CRM_BUSI_ValidateUserApp @UCode,@AppModel,@NeedShow Output
If(@NeedShow = 1)
Begin
Insert Into @Apps(AppModel)
Values(@AppModel)
End
FETCH NEXT FROM cur_app INTO @AppModel
End
CLOSE cur_app
DEALLOCATE cur_appSelect * From @Apps

解决方案 »

  1.   

    create or replace procedure S_CRM_BUSI_GetUserApps( @UCode varchar2(50), o_cursor sys_refcursor)
    is
    -- 获取用户有权限访问的应用
      sqlStr  varchar2(8000);
    begin
    CREATE GLOBAL TEMPORARY TABLE @Apps
    (
    AppModel varchar2(100)
    )
    Declare @AppModel varchar2(100);
    Declare @NeedShow integer;
    declare Cursor cur_app is Select ObjCode From sys_spec Where sys_spec.objtype = 'app' And isdisonmain = 1
    open cur_app;
    loop 
    fetch ObjCode into @AppModel
        --S_CRM_BUSI_ValidateUserApp 这个存储过程也要修改成ORacle的才行
        Exec S_CRM_BUSI_ValidateUserApp @UCode,@AppModel,@NeedShow Output
        If @NeedShow = 1
        Begin
          Insert Into @Apps(AppModel)
          Values(@AppModel)
        End
    end loop;
    CLOSE cur_app;opern o_cursor for Select * From @Apps ;