java调用 oracle 用户登录存储过程 随笔

PROCEDURE user_Login (
      i_AuthID         IN       user_UserPass.UserID%TYPE,        --用户代码
      i_FunctionCode   IN       user_Function.FunctionCode%TYPE,      --功能代码
      i_Password       IN       user_UserPass.PASSWORD%TYPE,          --密码
      o_RetCode        OUT      INT,
      o_RetMsg         OUT      VARCHAR2
   )
/* 授权验证 */
   IS
      l_location             VARCHAR2 (128);
      l_Exist                INTEGER;
      l_Count                INTEGER;
      l_Counter              INTEGER;
      l_FunctionCode         user_Function.FunctionCode%TYPE;
      l_ParentFunctionCode   user_Function.FunctionCode%TYPE;//父根限功能代码
      l_Passed               BOOLEAN;
      l_Length               INTEGER;
   BEGIN
      o_RetCode := 0;
      o_RetMsg := '操作成功';
      l_location := '验证用户登录';
      up_SetClearLog ('user_Login',
                      '验证用户权限',
                      'INTO',
                      'admin',
                      ''
                     );//操作日志

      SELECT COUNT (*)
        INTO l_Exist
        FROM  user_UserPass    //用户表
       WHERE UserID = i_AuthID AND PASSWORD = i_Password;

      IF l_Exist <> 1
      THEN
         o_RetCode := 1;
         o_RetMsg := '授权验证,用户名或密码无效失败';
         up_SetClearLog ('user_Login',
                      '验证用户权限',
                      'ERROR',
                      'admin',
                      ''
                     );//操作日志
         RETURN;
      END IF;

      l_location := '验证用户权限';

      SELECT COUNT (*)
        INTO l_Count
        FROM user_Function f
 WHERE TYPE = 'admin'//查找该用户功能代码
      

      IF l_Count = 0
      THEN
         o_RetCode := 12;
         o_RetMsg := '权限代码有误';
         up_SetClearLog ('user_Login',
                      '验证用户权限',
                      'ERROR',
                      'admin',
                      ''
                     );//操作日志
         RETURN;
      END IF;

      o_RetCode := 0;
      o_RetMsg := '授权验证成功';
      up_SetClearLog ('user_Login',
                      '验证用户权限',
                      'SUCCESS',
                      'admin',
                      ''
                     );//操作日志
   EXCEPTION
      WHEN OTHERS
      THEN
         o_RetCode := 1;
         o_RetMsg := '操作失败!错误位置:' || l_location;
         up_SetClearLog ('user_Login',
                         o_RetMsg,
                         'WARN',
                         'admin',
                         ''
                        );
   END user_Login;

 

贴出来以供大家参考

你可能感兴趣的:(java,oracle,F#,UP)