PLSQL中INDEX BY TABLE的 DELETE操作
开始
DELETE(n) 指代的是 删除下标为n 的元素,那么对于下标不连续的情形,会如何呢?
--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'; enm_table.DELETE(5); IF enm_table.EXISTS(6) THEN dbms_output.put_line('exists(6)'); ELSE dbms_output.put_line('not exists(6)'); END IF; END; /
运行结果:
anonymous block completed exists(6)
结束