12
votes

Utiliser des tables d'enregistrements dans pl / sql

J'ai déclaré les types suivants dans mon package PL / SQL:

PLS-00306: wrong number or types of arguments in call to 'EXTEND'


0 commentaires

4 Réponses :


8
votes

Vous ne pouvez pas étendre un tableau associatif. Il suffit d'assigner des valeurs xxx


0 commentaires

24
votes

Vous n'allez pas une table indexée par "quelque chose", vous pouvez simplement l'utiliser ...

DECLARE
   TYPE t_simple_object IS RECORD 
      ( wert   NUMBER
      , gs     NUMBER
      , vl     NUMBER
      ); 

   TYPE t_obj_table IS TABLE OF t_simple_object; 

   my_rec t_simple_object;
   obj t_obj_table := t_obj_table(); 
BEGIN
   obj.EXTEND;
   my_rec.wert := 1;
   my_rec.gs := 1;
   my_rec.vl := 1;
   obj(1) := my_rec;
END;
/


0 commentaires

8
votes

Si vous ne voulez pas utiliser une matrice associative (AKA Index-by Table), laissez la clause «Index de Binary_Integer». Votre code fonctionne alors OK:

declare 
    TYPE t_simple_object IS RECORD (
       wert   NUMBER,
       gs     NUMBER,
       vl     NUMBER);
    TYPE t_obj_table IS TABLE OF t_simple_object;
    obj t_obj_table;
begin  
    obj := t_obj_table ();
    obj.EXTEND();
end;


0 commentaires

-1
votes

ou simplement utiliser un enregistrement (ou un tableau associé d'enregistrements) xxx


0 commentaires