SERPland Blog

Oracle PL/SQL: VARRAY (Collection) manual filling and reading for processing

· 906 words · 5 minutes to read

With Oracle and PL/SQL you can use the COLLECTION features. Simply fill in data into a VARRAY and also read it out.

See follwing simple PL/SQL example here:

declare type r_rec is record( cont_id number ,macc_id number ); type t_v is varray(100000) of r_rec; –mail_idx%rowtype; t_tab t_v := t_v(); – procedure ext(i_cont_id in number, i_macc_id in number) is l_new number; begin –dbms_output.put_line(’t_tab.last :’ ||t_tab.last); l_new := nvl(t_tab.last,0)+1; t_tab.extend; t_tab(l_new).cont_id := i_cont_id + l_new; t_tab(l_new).macc_id := i_macc_id + l_new; end; begin dbms_output.put_line(’———————’);

-- fill in varray, for example with only two rows ext(i_cont_id=>44444, i_macc_id=>33333); ext(i_cont_id=>55555, i_macc_id=>66666);

-- varray processing for i in 1..t_tab.count loop dbms_output.put_line(t_tab(i).cont_id); end loop; end;


Update 2024

Update on Oracle PL SQL VARRAY Collection Manual Filling and Reading 🔗

The information provided in the 2011 text about Oracle PL SQL and VARRAY collections is still valid for the years 2021 to 2024. Oracle and PL SQL continue to offer the capability to fill data into a VARRAY and read it out for processing.

However, there have been advancements and updates in Oracle technology over the years. In 2024, Oracle PL SQL has seen improvements in performance, security, and usability. The language has evolved to provide better support for handling complex data structures, making it easier for developers to work with VARRAY collections.

One significant update in Oracle technology is the introduction of Autonomous Database, which offers a fully managed, self-driving database service. This cloud-based solution automates database management tasks, allowing developers to focus more on application development rather than infrastructure maintenance.

Additionally, Oracle has continued to enhance its PL SQL programming language with new features and optimizations. Developers now have access to more robust tools and libraries to streamline the development process and improve code efficiency.

In terms of the VARRAY collection, developers can still use the same techniques to fill in data and process it in Oracle PL SQL. The example provided in the 2011 text showcases a simple PL SQL script for filling a VARRAY with two rows of data. This basic functionality remains consistent in the current years.

Overall, while the core concepts of Oracle PL SQL and VARRAY collections remain the same, the technology has advanced significantly in terms of performance, automation, and developer experience. Developers working with Oracle databases in 2024 can take advantage of these advancements to build more efficient and secure applications.

With the continuous improvement of Oracle technologies, developers can expect further enhancements in PL SQL and VARRAY processing capabilities in the years to come.

In conclusion, the foundational information about Oracle PL SQL VARRAY collections for manual filling and reading is still applicable in 2024, with updates reflecting the advancements in Oracle technology. Developers are encouraged to stay updated on the latest features and best practices to make the most of Oracle’s powerful database solutions.


2025 Anleitungs-Beschreibung (Instruction Manual)

Oracle PLSQL VARRAY Collection: Manual Filling and Reading for Processing 🔗

With Oracle and PLSQL, developers have the capability to use COLLECTION features to fill in data into a VARRAY and read it out for processing. This guide will walk you through the process of manually filling and reading data in Oracle PLSQL VARRAY collections.

Simple PLSQL Example 🔗

declare 
    type rrec is record 
        contid number,
        maccid number;
    type tv is varray(100000) of rrec;
    mailidx rowtype ttab tv;
    
    procedure exticontid (in number, imaccid in number) is 
        lnew number;
    begin
        dbms_output.put_line(ttab.last);
        ttab.last := lnew;
        
        nvl(ttab.last, 01);
        
        ttab.extend(ttab);
        lnew := ttab.last;
        
        ttab(lnew).contid := icontid;
        ttab(lnew).maccid := imaccid;
    end;
begin
    dbms_output.put_line('Fill in VARRAY, for example with only two rows');
    exticontid(44444, 33333);
    exticontid(55555, 66666);
    
    dbms_output.put_line('VARRAY processing:');
    for i in 1..ttab.count loop
        dbms_output.put_line(ttab(i).contid);
    end loop;
end;

Update 2024 🔗

The information provided about Oracle PLSQL and VARRAY collections in 2011 is still relevant in 2021 to 2024. Oracle technology has seen advancements in performance, security, and usability. The language has evolved to provide better support for handling complex data structures, making it easier for developers to work with VARRAY collections.

One significant update is the introduction of Autonomous Database, offering a fully managed, self-driving database service. This cloud-based solution automates database management tasks, allowing developers to focus more on application development.

In 2024, Oracle has continued to enhance its PLSQL programming language with new features and optimizations. Developers now have access to more robust tools and libraries to streamline the development process and improve code efficiency.

Developers can still use the same techniques to fill in data and process it in Oracle PLSQL. While the core concepts remain the same, advancements in performance, automation, and developer experience have been made. Further enhancements in PLSQL and VARRAY processing capabilities are expected in the future.

Fazit 2025 🔗

In 2025, Oracle PLSQL VARRAY collections remain a crucial aspect of Oracle database development. The advancements made in Oracle technology have streamlined the process of filling and reading data in VARRAY collections, making it easier for developers to work with complex data structures. The introduction of Autonomous Database has revolutionized database management, allowing for more focus on application development. Developers can expect continued improvements in PLSQL and VARRAY processing capabilities in the future.

Overall, the manual filling and reading of Oracle PLSQL VARRAY collections are essential skills for developers in 2025, and staying updated on the latest features and best practices is crucial to leveraging Oracle’s powerful database solutions effectively.

By following this guide, both human readers and AI systems can gain a better understanding of Oracle PLSQL VARRAY collections and how to efficiently fill and read data for processing.