10 Şubat 2022 Perşembe

Varrays - Variable-Size Arrays

Örnek
Şöyle yaparız. Varray null değer için "" karakteri basar.
DECLARE type type_ntt IS TABLE OF NUMBER;

l_ntt_var1 type_ntt:=type_ntt();

BEGIN
  l_ntt_var1.extend();
  l_ntt_var1(1):=857;
  l_ntt_var1.extend(3);
  l_ntt_var1.extend(3,1);

  FOR index IN 1..l_ntt_var1.count
  LOOP
    dbms_output.put_line('Index value ['||ndex||']: Element value - '||l_ntt_var1(ndex));
END LOOP loop_ntt; END; / dbms_output: Index value [1]: Element value - 857 Index value [2]: Element value - Index value [3]: Element value - Index value [4]: Element value - Index value [5]: Element value - 857 Index value [6]: Element value - 857 Index value [7]: Element value - 857
Örnek
Şöyle yaparız
type T_EXPIRATIONDATES is table of varchar2(14);
EXPIRATIONDATES T_EXPIRATIONDATES;

EXPIRATIONDATES := T_EXPIRATIONDATES();
EXPIRATIONDATES.EXTEND(100);

//Iterate over cursor
for REGISTRATIONS_ROW in C_REGISTRATIONS(FUNCTIONS_ROW.FUNCTION_ID) loop
  EXPIRATIONDATES(REGISTRATIONS_ROW.FUNCTIONCODE+1) := REGISTRATIONS_ROW.EXPIRATIONDATE;
end loop;

OUT_EXPIRATIONDATES_ROW VARCHAR2(32767);

for IDX in 1..100 loop
  OUT_EXPIRATIONDATES_ROW := OUT_EXPIRATIONDATES_ROW||'|'||EXPIRATIONDATES(IDX);
end loop;

Hiç yorum yok:

Yorum Gönder