PLSQL中INDEX BY TABLE 的 prior 和 next 操作学习
开始
--INDEX BY Table SET SERVEROUTPUT ON; DECLARE TYPE enm_tab_type IS TABLE OF emp.ename%TYPE INDEX BY BINARY_INTEGER; enm_table enm_tab_type; BEGIN enm_table(1):='1001'; enm_table(2):='1002'; enm_table(3):='1003'; enm_table(4):='1004'; enm_table(6):='1006'; dbms_output.put_line( 'NEXT(3) is:' ||enm_table.NEXT(3)); dbms_output.put_line( 'NEXT(4) is:' ||enm_table.NEXT(4)); dbms_output.put_line( 'PRIOR(6) is:' ||enm_table.PRIOR(6)); END; /
运行结果:
anonymous block completed NEXT(3) is:4 NEXT(4) is:6 PRIOR(6) is:4
也就是说 index 可以下标不连续。
结束