`
cqh520llr
  • 浏览: 509669 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

广东11选5直2

 
阅读更多
DECLARE
  V_FIRST  VARCHAR(2);
  V_SECOND VARCHAR2(2);
  V_BALL   VARCHAR2(8) := '11120270';
  CURSOR CUR_BALL IS
    SELECT *
      FROM (SELECT *
              FROM BALL_ELEVEN
             WHERE BALL_FIRST = V_FIRST
               AND BALL_SECOND = V_SECOND
             ORDER BY BALL_NO DESC) C
     WHERE ROWNUM = 1;
  BALL_TBL BALL_ELEVEN%ROWTYPE;
  V_COUNT  NUMBER(10);
BEGIN
  FOR I IN 1 .. 11 LOOP
    V_FIRST := LPAD(I, 2, '0');
    FOR J IN 1 .. 11 LOOP
      IF J != I THEN
        V_SECOND := LPAD(J, 2, '0');
        OPEN CUR_BALL;
        LOOP
          FETCH CUR_BALL
            INTO BALL_TBL;
          EXIT WHEN CUR_BALL%NOTFOUND;
          V_COUNT := (TO_DATE(SUBSTR(V_BALL, 1, 6), 'yymmdd') -
                     TO_DATE(SUBSTR(BALL_TBL.BALL_NO, 1, 6), 'yymmdd')) * 70 +
                     TO_NUMBER(SUBSTR(V_BALL, 7, 8)) -
                     TO_NUMBER(SUBSTR(BALL_TBL.BALL_NO, 7, 8));
          DBMS_OUTPUT.PUT_LINE(V_FIRST || '-' || V_SECOND || ': ' ||
                               V_COUNT);
        END LOOP;
        CLOSE CUR_BALL;
      END IF;
    END LOOP;
  END LOOP;
END;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics