PLSQL collection 示例 之 Nested Tables

来源:互联网 发布:深圳网络诈骗被骗5万 编辑:程序博客网 时间:2024/06/06 12:51

A nested table is like a one-dimensional array.An array has a declared number of elements, but a nested table does not. The size of a nested table can increase dynamically.

删数据,其他element的下标不变

DECLARE
TYPE name_table IS TABLE OF VARCHAR2(10);
TYPE score_table IS TABLE OF INTEGER;

names name_table;
scores score_table;
total integer;
BEGIN
names := name_table(‘Kavita’, ‘Pritam’, ‘Ayan’, ‘Rishav’, ‘Aziz’);
scores:= score_table(98, 97, 78, 87, 92);
total := names.count;
dbms_output.put_line(‘Total ‘|| total || ’ Students’);
FOR i IN 1 .. total LOOP
dbms_output.put_line(‘Student:’||names(i)||’, Scores:’ || scores(i));
end loop;
END;

0 0