Zoeken…


Bulk gegevensverwerking

lokale collecties zijn niet toegestaan in bepaalde overzichten. Daarom is de eerste stap het maken van een verzameling op schemaniveau. Als de verzameling geen schemaniveau is en wordt gebruikt in SELECT-instructies, zou dit "PLS-00642: lokale verzamelingstypen niet toegestaan in SQL-instructies" veroorzaken

CREATE OR REPLACE TYPE table1_t IS OBJECT (
a_1 INTEGER,
a_2 VARCHAR2(10)
);

- machtigingen voor het verzamelen zodat het publiekelijk in de database kan worden gebruikt

     GRANT EXECUTE ON table1_t TO PUBLIC;
     CREATE OR REPLACE TYPE table1_tbl_typ IS TABLE OF table1_t;
     GRANT EXECUTE ON table1_tbl_typ TO PUBLIC;

- ophalen van gegevens van tabel naar verzameling en vervolgens door de verzameling bladeren en de gegevens afdrukken.

    DECLARE
     table1_tbl table1_tbl_typ;
    BEGIN
     table1_tbl := table1_tbl_typ();
      SELECT table1_t(a_1,a_2)  
      BULK COLLECT INTO table1_tbl 
      FROM table1 WHERE ROWNUM<10;

     FOR rec IN (SELECT a_1 FROM TABLE(table1_tbl))--table(table1_tbl) won't give error)
     LOOP
       dbms_output.put_line('a_1'||rec.a_1);
       dbms_output.put_line('a_2'||rec.a_2);
     END LOOP;
    END;
/


Modified text is an extract of the original Stack Overflow Documentation
Licentie onder CC BY-SA 3.0
Niet aangesloten bij Stack Overflow