游标属性
兼容Oracle游标属性
%ISOPEN、%FOUND、%NOTFOUND、%ROWCOUNT
vastbase=# DO $$ DECLARE vastbase$# v_empno NUMBER(4); vastbase$# v_ename VARCHAR2(10); vastbase$# CURSOR emp_cur is SELECT empno, ename FROM emp ORDER BY empno; vastbase$# BEGIN vastbase$# OPEN emp_cur; vastbase$# IF emp_cur%ISOPEN THEN vastbase$# RAISE NOTICE 'CURSOR OPEN'; vastbase$# END IF; vastbase$# LOOP vastbase$# FETCH emp_cur INTO v_empno, v_ename; vastbase$# EXIT WHEN emp_cur%NOTFOUND; vastbase$# IF emp_cur%FOUND THEN vastbase$# RAISE NOTICE 'FOUOND'; vastbase$# RAISE NOTICE 'rowcount : %',emp_cur%rowcount; vastbase$# end if; vastbase$# DBMS_OUTPUT.PUT_LINE(v_empno || ' ' || v_ename); vastbase$# END LOOP; vastbase$# CLOSE emp_cur; vastbase$# END $$; NOTICE: CURSOR OPEN NOTICE: FOUOND NOTICE: rowcount : 1 NOTICE: FOUOND NOTICE: rowcount : 2 NOTICE: FOUOND NOTICE: rowcount : 3 NOTICE: FOUOND NOTICE: rowcount : 4 NOTICE: FOUOND NOTICE: rowcount : 5 NOTICE: FOUOND NOTICE: rowcount : 6 NOTICE: FOUOND NOTICE: rowcount : 7 NOTICE: FOUOND NOTICE: rowcount : 8 NOTICE: FOUOND NOTICE: rowcount : 9 NOTICE: FOUOND NOTICE: rowcount : 10 NOTICE: FOUOND NOTICE: rowcount : 11 NOTICE: FOUOND NOTICE: rowcount : 12 ANONYMOUS BLOCK EXECUTE