码迷,mamicode.com
首页 > 其他好文 > 详细

标准简单SP模板

时间:2014-12-31 16:06:38      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

/*
-- @author:    Lijy
-- @function: 员工入职的信息检查程序
-- @parr: P_URID 为workshop操作账号的ID,前台通过 {U_URID} 全局参数获取
*/

CREATE OR REPLACE Procedure eSP_StaffCheck
(
    P_ID  integer,
    P_URID integer,
    P_Retval Out integer
)
As
    P_compid integer;
    P_i Integer;
    e_exception  Exception;

Begin

   P_RetVal:=0;
   P_i:=0;

   Select compid into P_compid From eStaff_Register where id = P_id;

  --数据已经确认!
    Select Count(1) Into P_i From dual
    Where
    Exists(Select 1 From eStaff_Register
            Where ID=P_ID And Nvl(Initialized,0)=1) ;

    If P_i = 1 Then
          P_Retval:=910000;
          raise e_exception;
    End if ;

  -- savepoint 
  Update eStaff_Register
  Set  Initialized = 1,
       InitializedBy = P_URID,
       InitializedTime =  sysdate
  Where ID=P_ID;
  
  commit;

Exception
    When e_exception then
        Null;
    When others then
        P_RetVal := -1;
        dbms_output.put_line(SQLERRM);

End eSP_StaffCheck1;

 

标准简单SP模板

标签:

原文地址:http://www.cnblogs.com/lijy/p/4195666.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!