Oracle PL/SQL - Decreasing Size of an VArray

Description

Decreasing Size of an VArray

Demo

SQL>
SQL> declare--  w  ww .j av a  2  s  .com
  2         type month_va is varray(13) of VARCHAR2(20);
  3         v_month_va month_va:=month_va();
  4         v_count_nr number;
  5  begin
  6         v_month_va.extend(3);
  7         v_month_va(1):='January';
  8         v_month_va(2):='February';
  9         v_month_va(3):='March';
 10
 11         v_month_va(2):=null;
 12         if v_month_va.exists (2)
 13         then
 14               DBMS_OUTPUT.put_line('Object Exists');
 15         end if;
 16
 17         v_month_va(3):=v_month_va(2);
 18         v_month_va.trim(1);
 19
 20         DBMS_OUTPUT.put_line('Count:'||v_month_va.count);
 21         DBMS_OUTPUT.put_line('Last:'||v_month_va.last);
 22  end;
 23  /
Object Exists
Count:2
Last:2

PL/SQL procedure successfully completed.
SQL>

Related Topic