Preamble
In Oracle PL/SQL, the EXISTS method is a function that tells you if a specified Varray or Nested Tables element exists.
Syntax of the EXISTS method in Oracle PL/SQL
collection_name.EXISTS (n);
Method parameters or arguments
- collection_name – the name of the collection.
- EXISTS (n) – returns TRUE if the n-th element of the collection exists and FALSE otherwise.
Note:
- If n is out of tolerance, EXISTS returns FALSE instead of calling the predefined exception SUBSCRIPT_OUTSIDE_LIMIT.
- For a remote item, EXISTS (n) returns FALSE even if DELETE has saved a place for it.
- See also collection methods: DELETE, TRIM, EXTEND, FIRST and LAST, COUNT, LIMIT, PRIOR and NEXT.
Consider an example to understand how to use the EXISTS collection method in Oracle PL/SQL.
EXISTS example with Nested Tables
Consider an example that initializes Nested Tables with four elements, deletes the second element and prints either the value or the status of the elements from 1 to 6.
DECLARE
TYPE NumList IS TABLE OF INTEGER;
n NumList := NumList(1,3,5,7);
BEGIN
n.DELETE(2); -- Delete the second element
FOR i IN 1...6 LOOP
IF n.EXISTS(i) THEN
DBMS_OUTPUT.PUT_LINE('n(' || i || ') = ' || n(i));
ELSE
DBMS_OUTPUT.PUT_LINE('n(' || i || ') does not exist');
END IF;
END LOOP;
END;
Result:
n(1) = 1
n(2) does not exist
n(3) = 5
n(4) = 7
n(5) does not exist
n(6) does not exist
PL/SQL tutorial: Collection Method EXISTS in Oracle Database
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
Empowering the Blockchain Revolution: How Enteros Enhances Performance Management and Cloud FinOps Efficiency in the Technology Sector through AI Performance Intelligence
- 11 November 2025
- Database Performance Management
Introduction The technology sector continues to evolve rapidly, with blockchain standing at the forefront of digital transformation. From decentralized finance (DeFi) to supply chain transparency and smart contracts, blockchain technology is reshaping how data is stored, verified, and transacted globally. However, behind this revolution lies a complex web of challenges — including database scalability, resource … Continue reading “Empowering the Blockchain Revolution: How Enteros Enhances Performance Management and Cloud FinOps Efficiency in the Technology Sector through AI Performance Intelligence”
Transforming Healthcare and E-commerce Efficiency: How Enteros Leverages Generative AI to Optimize SaaS Database Performance and Drive Digital Innovation
- 10 November 2025
- Database Performance Management
Introduction In an era defined by data-driven transformation, both the healthcare and e-commerce sectors stand as two of the most dynamic and fast-evolving industries. While their missions differ — one saves lives and the other shapes consumer experiences — both share a common foundation: data.Every patient interaction, online purchase, diagnostic scan, or personalized recommendation depends … Continue reading “Transforming Healthcare and E-commerce Efficiency: How Enteros Leverages Generative AI to Optimize SaaS Database Performance and Drive Digital Innovation”
Driving RevOps Excellence in the Technology Sector: How Enteros Combines AIOps Intelligence and Database Performance Management for Superior Operational Efficiency
Introduction The technology sector thrives on innovation, speed, and precision. As organizations accelerate digital transformation, the pressure to maintain database performance, system reliability, and cost efficiency intensifies. With expanding workloads, hybrid cloud infrastructures, and distributed databases, achieving seamless performance management across platforms becomes increasingly complex. This complexity directly impacts Revenue Operations (RevOps) — the strategic … Continue reading “Driving RevOps Excellence in the Technology Sector: How Enteros Combines AIOps Intelligence and Database Performance Management for Superior Operational Efficiency”
Why AI Projects Fail Before They Start — Data Quality First
Insight for CIOs, FinOps and IT Leaders in 2025 Introduction AI is everywhere in boardroom conversations: promises of automation, predictive insights, and competitive advantage. Yet behind the hype lies a sobering reality — most AI projects stall before they deliver measurable value. The paradox is striking: the algorithms are powerful, but the data feeding them … Continue reading “Why AI Projects Fail Before They Start — Data Quality First”