zoukankan      html  css  js  c++  java
  • Oracle EBS 加锁解锁程序

      FUNCTION request_lock(p_lock_name IN VARCHAR2) RETURN BOOLEAN IS
        l_lock_name   VARCHAR2(128);
        l_lock_ret    INTEGER;
        l_ret_val     BOOLEAN := TRUE;
        l_lock_handle VARCHAR2(240);
      BEGIN
        IF p_lock_name IS NOT NULL THEN
          --增加数据库锁,以保证一个批次同时只运行一次
          l_lock_name := p_lock_name;
          dbms_lock.allocate_unique(lockname   => l_lock_name,
                                    lockhandle => l_lock_handle);
          g_lock_handle := l_lock_handle;
          --获取数据库锁
          l_lock_ret := dbms_lock.request(lockhandle        => l_lock_handle,
                                          lockmode          => 6,
                                          timeout           => 10,
                                          release_on_commit => FALSE);
          IF l_lock_ret <> 0 THEN
            --状态不为(成功)
            l_ret_val := FALSE;
          END IF;
        ELSE
          l_ret_val := FALSE;
        END IF;
        cux_conc_utl.log_msg('request lock');
        RETURN l_ret_val;
      END request_lock;
     PROCEDURE release_lock(p_lock_name IN VARCHAR2) IS
        l_lock_name   VARCHAR2(128);
        l_lock_handle VARCHAR2(128);
        l_lock_ret    INTEGER;
      BEGIN
        IF g_lock_handle IS NOT NULL THEN
          l_lock_ret := dbms_lock.release(g_lock_handle);
        ELSE
          l_lock_name := p_lock_name;
          dbms_lock.allocate_unique(lockname   => l_lock_name,
                                    lockhandle => l_lock_handle);
          l_lock_ret    := dbms_lock.release(l_lock_handle);
          g_lock_handle := l_lock_handle;
        END IF;
        cux_conc_utl.log_msg('release_lock: ' || l_lock_ret);
      END release_lock;
    土豆君
  • 相关阅读:
    刚装的ESET NOD32无法更新
    借ISA东风,安全发布多个网站
    ASP.NET写入XML访问被拒绝
    ADOBE CS3 序列号
    IEPLUS(IE增强性插件)
    joomla 1.5 笔记
    joomla与drupal内核差异分析
    Drupal修改默认后台地址(D6)
    drupal7指定menu高亮问题
    Drupal6 邮件群发到指定角色
  • 原文地址:https://www.cnblogs.com/jenrry/p/10006867.html
Copyright © 2011-2022 走看看