zoukankan      html  css  js  c++  java
  • 自动进程的存储过程

    CREATE OR REPLACE PROCEDURE QUEUE_READ_FIRST_ITEM_QNAME( P_RESULTSET OUT SYS_REFCURSOR, QUEUENAME IN VARCHAR)
    IS
    SPNR_ID VARCHAR(20);
    QUEUE_ID INT;
    QUEUE_NAME VARCHAR(40);
    BEGIN
    SELECT SPNRID, QUEUEID, NAME
    INTO SPNR_ID, QUEUE_ID, QUEUE_NAME
    FROM (
    SELECT QUEUEITEMS.SPNRID, QUEUES.QUEUEID, QUEUES.NAME
    FROM HX_xrezagent.QUEUEITEMS
    INNER JOIN QUEUES ON QUEUES.QUEUEID=QUEUEITEMS.QUEUEID
    WHERE QUEUES.NAME = QUEUENAME AND QUEUES.ACTIVE = 1 AND ACCESSED < (OJ_TIMESTAMP() - interval '10' minute) AND CREATED <= OJ_TIMESTAMP()
    ORDER BY URGENT DESC, CREATED ASC)
    WHERE ROWNUM = 1;
    UPDATE QUEUEITEMS SET ACCESSED = OJ_TIMESTAMP WHERE QUEUEID = QUEUE_ID AND SPNRID = SPNR_ID;
    OPEN P_RESULTSET FOR SELECT SPNR_ID SPNRID, QUEUE_ID QUEUEID, QUEUE_NAME NAME FROM DUAL;
    EXCEPTION
    WHEN no_data_found
    THEN
    OPEN P_RESULTSET FOR SELECT * FROM DUAL WHERE 1 = 2;
    END QUEUE_READ_FIRST_ITEM_QNAME;

  • 相关阅读:
    CentOS 6.5 伪分布式 安装 hadoop 2.6.0
    单例模式的思想简介
    最有二叉树 哈夫曼树
    二叉树2
    二叉树1
    栈与队列
    线性表
    字符串模式匹配KMP算法
    数据结构(四) 查找 排序
    数据结构(三) 图
  • 原文地址:https://www.cnblogs.com/mkl34367803/p/10962096.html
Copyright © 2011-2022 走看看