Preamble
In Oracle PL/SQL, the MULTISET UNION collection operation returns the merging of two collections
MULTISET UNION syntax in Oracle PL/SQL
nt1 MULTISET UNION nt2
Collection parameters and arguments
- nt1, nt2 – collections to combine
Note:
- Operations are possible only with nested tables collections. Both collections that participate in an operation must be of the same type. The result of the operation is also a collection of nested tables.
Consider some examples of operations on the MULTISET UNION collections to understand how to use MULTISET UNION in Oracle PL/SQL
For example:
DECLARE
reslt varchar2(100);
TYPE nested_typ IS TABLE OF NUMBER;
nt1 nested_typ := nested_typ(1,2,3);
nt2 nested_typ := nested_typ(3,2,1);
nt3 nested_typ := nested_typ(2,3,1,3);
answer nested_typ;
BEGIN
answer := nt1 MULTISET UNION nt2;
for iter in answer.first ... answer.last
loop
if iter = 1 then
reslt:=answer(iter);
else
reslt := reslt ||', '||to_char(answer(iter));
end if;
end loop;
dbms_output.put_line('nt1 MULTISET UNION nt2 = '||reslt);
--Output: nt1 MULTISET UNION nt2 = 1, 2, 3, 3, 2, 1
answer := nt1 MULTISET UNION nt3;
for iter in answer.first ... answer.last
loop
if iter = 1 then
reslt:=answer(iter);
else
reslt := reslt ||', '||to_char(answer(iter));
end if;
end loop;
dbms_output.put_line('nt1 MULTISET UNION nt3 = '||reslt);
--Output: nt1 MULTISET UNION nt3 = 1, 2, 3, 2, 3, 1, 3.
END;
Another example of MULTISET UNION with line collections
DECLARE
reslt varchar2(100);
TYPE nested_typ IS TABLE OF varchar2(20);
nt1 nested_typ := nested_typ('alpha', 'beta', 'gamma');
nt2 nested_typ := nested_typ('beta', 'gamma', 'alpha');
nt3 nested_typ := nested_typ('beta', 'alpha', 'gamma', 'delta');
answer nested_typ;
BEGIN
answer := nt1 MULTISET UNION nt2;
for iter in answer.first ... answer.last
loop
if iter = 1 then
reslt:=answer(iter);
else
reslt := reslt ||', '||answer(iter);
end if;
end loop;
dbms_output.put_line('nt1 MULTISET UNION nt2 = '||reslt);
--Output: nt1 MULTISET UNION nt2 = alpha, beta, gamma, gamma, alpha
answer := nt1 MULTISET UNION nt3;
for iter in answer.first ... answer.last
loop
if iter = 1 then
reslt:=answer(iter);
else
reslt := reslt ||', '||answer(iter);
end if;
end loop;
dbms_output.put_line('nt1 MULTISET UNION nt3 = '||reslt);
--Output: nt1 MULTISET UNION nt3 = alpha, beta, gamma, alpha, gamma, delta
END;
Set-Level Manipulation of Nested Tables (MULTISET)
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Accurate Healthcare Cloud Cost Estimation with Enteros: An AIOps-Driven FinOps Approach
- 15 January 2026
- Database Performance Management
Introduction Healthcare organizations are undergoing rapid digital transformation. Electronic health records (EHRs), telemedicine platforms, AI-driven diagnostics, patient engagement portals, population health analytics, and regulatory reporting systems now form the backbone of modern healthcare delivery. At the center of all these innovations lies a complex, data-intensive cloud infrastructure powered by mission-critical databases. While cloud adoption has … Continue reading “Accurate Healthcare Cloud Cost Estimation with Enteros: An AIOps-Driven FinOps Approach”
Why Traditional Banking Database Optimization Falls Short, and How Enteros Fixes It with GenAI
Introduction Modern banking has become a real-time, always-on digital business. From core banking systems and payment processing to mobile apps, fraud detection, risk analytics, and regulatory reporting—every critical banking function depends on database performance. Yet while banking technology stacks have evolved dramatically, database optimization practices have not. Most banks still rely on traditional database tuning … Continue reading “Why Traditional Banking Database Optimization Falls Short, and How Enteros Fixes It with GenAI”
Smarter BFSI Database Operations: How Enteros Applies GenAI to Cloud FinOps and RevOps
- 14 January 2026
- Database Performance Management
Introduction Banks, financial institutions, insurers, and fintech organizations operate in one of the most complex and regulated technology environments in the world. Digital banking platforms, real-time payments, core transaction systems, fraud detection engines, regulatory reporting platforms, and customer engagement channels all depend on highly reliable database operations. As BFSI organizations modernize their technology stacks, database … Continue reading “Smarter BFSI Database Operations: How Enteros Applies GenAI to Cloud FinOps and RevOps”
How Enteros Uses AIOps to Transform Database Performance Management and Cloud FinOps
Introduction As enterprises accelerate cloud adoption, digital transformation has fundamentally reshaped how applications are built, deployed, and scaled. At the center of this transformation lies a critical but often overlooked layer: databases. Every transaction, customer interaction, analytics workflow, and AI model ultimately depends on database performance. Yet for many organizations, database performance management and cloud … Continue reading “How Enteros Uses AIOps to Transform Database Performance Management and Cloud FinOps”