Preamble
In Oracle PL/SQL, an operation on SET collections returns a collection with distinct (i.e. a collection without takes).
SET syntax in Oracle PL/SQL
SET (nt)
Parameters and arguments of the operation
- nt – collection from which duplicates are removed
Note:
- Operations are possible only with collections of nested tables. The result of the operation is also a collection of nested tables.
Consider an example operation on SET collections to understand how to use SET in Oracle PL/SQL
For example:
DECLARE
reslt varchar2(100);
TYPE nested_typ IS TABLE OF NUMBER;
nt3 nested_typ := nested_typ(2,3,1,3,4);
answer nested_typ;
BEGIN
answer := SET (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('SET (nt3) = '||reslt);
--Output: SET (nt3) = 2, 3, 1, 4
END;
Another example of SET with string collections
DECLARE
reslt varchar2(100);
TYPE nested_typ IS TABLE OF varchar2(20);
nt3 nested_typ := nested_typ('beta', 'alpha', 'gamma', 'delta', 'gamma', 'alpha');
answer nested_typ;
BEGIN
answer := SET (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('SET (nt3) = '||reslt);
--Output: SET (nt3) = beta, alpha, gamma, delta
END;
Oracle Set operator union unionall intersect minus
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
How to Optimize Media Sector Growth with Enteros Database Management, Cost Attribution, Data Management, and Cloud FinOps
- 13 April 2026
- Database Performance Management
Introduction The media sector is evolving rapidly, driven by digital streaming, real-time content delivery, AI-powered personalization, and data-intensive production workflows. From OTT platforms and digital publishing to gaming and advertising networks, media companies are generating and processing massive volumes of data every second. As competition intensifies, media organizations must deliver seamless user experiences while managing … Continue reading “How to Optimize Media Sector Growth with Enteros Database Management, Cost Attribution, Data Management, and Cloud FinOps”
How to Optimize Telecom Sector Growth with Enteros Performance Management, Cost Estimation, and RevOps Efficiency
Introduction The telecom sector is at the center of global digital transformation, powering connectivity for businesses, consumers, and emerging technologies like 5G, IoT, and cloud computing. Telecom providers are under constant pressure to deliver high-speed, reliable services while managing massive data volumes and complex infrastructure. However, as telecom networks expand and digital services grow, companies … Continue reading “How to Optimize Telecom Sector Growth with Enteros Performance Management, Cost Estimation, and RevOps Efficiency”
How to Optimize Retail Sector Growth with Enteros Growth Management, Cloud FinOps, and Cloud Cost Management
- 12 April 2026
- Database Performance Management
Introduction The retail sector is evolving at an unprecedented pace, driven by digital transformation, eCommerce expansion, omnichannel strategies, and data-driven customer engagement. Retailers today must deliver seamless shopping experiences across online and offline channels while managing increasingly complex IT infrastructures. However, rapid growth brings a critical challenge:how to scale operations efficiently while controlling cloud costs … Continue reading “How to Optimize Retail Sector Growth with Enteros Growth Management, Cloud FinOps, and Cloud Cost Management”
How to Optimize Real Estate Sector Growth with Enteros Database Management, Cloud Billing, IT Finance Integration, Cloud FinOps, and AIOps Platform
Introduction The real estate sector is experiencing a digital transformation driven by property technology (PropTech), smart buildings, data-driven investment strategies, and online property marketplaces. From residential and commercial property management to real-time analytics for investment decisions, real estate companies are increasingly dependent on digital infrastructure. However, this transformation introduces a critical challenge:how to manage growth … Continue reading “How to Optimize Real Estate Sector Growth with Enteros Database Management, Cloud Billing, IT Finance Integration, Cloud FinOps, and AIOps Platform”