VastbaseE100

基于开源技术的HTAP数据库管理系统。性能优异,稳定可靠,提供诸多专属领域特性。

Menu

游标属%ISOPEN、%FOUND、%NOTFOUND、%ROWCOUNT

atlasdb=# DO $$ DECLARE
atlasdb$#  v_empno NUMBER(4);
atlasdb$#  v_ename VARCHAR2(10);
atlasdb$#   emp_cur CURSOR is  SELECT empno, ename FROM emp ORDER BY empno;
atlasdb$# BEGIN
atlasdb$#  OPEN emp_cur;
atlasdb$#   IF emp_cur%ISOPEN THEN 
atlasdb$#       RAISE NOTICE 'CURSOR OPEN';
atlasdb$#   END IF;
atlasdb$#  LOOP
atlasdb$#  FETCH emp_cur INTO v_empno, v_ename;
atlasdb$#  EXIT WHEN emp_cur%NOTFOUND;
atlasdb$#  IF emp_cur%FOUND THEN 
atlasdb$#  RAISE NOTICE 'FOUOND';
atlasdb$#  RAISE NOTICE 'rowcount : %',emp_cur%rowcount;
atlasdb$#  end if;
atlasdb$#  DBMS_OUTPUT.PUT_LINE(v_empno || ' ' || v_ename);
atlasdb$#  END LOOP;
atlasdb$#  CLOSE emp_cur;
atlasdb$# END $$;
NOTICE:  CURSOR OPEN
NOTICE:  FOUOND
NOTICE:  rowcount : 1
NOTICE:  7369 SMITH
NOTICE:  FOUOND
NOTICE:  rowcount : 2
NOTICE:  7499 ALLEN
NOTICE:  FOUOND
NOTICE:  rowcount : 3
NOTICE:  7521 WARD
NOTICE:  FOUOND
NOTICE:  rowcount : 4
NOTICE:  7566 JONES
NOTICE:  FOUOND
NOTICE:  rowcount : 5
NOTICE:  7654 MARTIN
NOTICE:  FOUOND
NOTICE:  rowcount : 6
NOTICE:  7698 BLAKE
NOTICE:  FOUOND
NOTICE:  rowcount : 7
NOTICE:  7782 CLARK
NOTICE:  FOUOND
NOTICE:  rowcount : 8
NOTICE:  7788 SCOTT
NOTICE:  FOUOND
NOTICE:  rowcount : 9
NOTICE:  7839 KING
NOTICE:  FOUOND
NOTICE:  rowcount : 10
NOTICE:  7844 TURNER
NOTICE:  FOUOND
NOTICE:  rowcount : 11
NOTICE:  7876 ADAMS
NOTICE:  FOUOND
NOTICE:  rowcount : 12
NOTICE:  7900 JAMES
NOTICE:  FOUOND
NOTICE:  rowcount : 13
NOTICE:  7902 FORD
NOTICE:  FOUOND
NOTICE:  rowcount : 14
NOTICE:  7934 MILLER
NOTICE:  FOUOND
NOTICE:  rowcount : 15
NOTICE:  9001 SMITH
NOTICE:  FOUOND
NOTICE:  rowcount : 16
NOTICE:  9002 JONES
NOTICE:  FOUOND
NOTICE:  rowcount : 17
NOTICE:  9003 ROGERS
NOTICE:  FOUOND
NOTICE:  rowcount : 18
NOTICE:  9004 PETERS
DO