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
Reducing Cloud Infrastructure Waste in BFSI with AIOps, FinOps, and Database Analytics
- 25 August 2026
- Database Performance Management
Introduction Banking, Financial Services, and Insurance (BFSI) organizations are rapidly adopting cloud infrastructure to support digital banking, payments, lending, insurance, fraud detection, financial analytics, and customer-facing applications. Cloud technology provides the scalability and flexibility needed to deliver always-on financial services, but it also creates a growing challenge: how can BFSI organizations control infrastructure waste without … Continue reading “Reducing Cloud Infrastructure Waste in BFSI with AIOps, FinOps, and Database Analytics”
How AI-Driven FinOps and AIOps Improve Performance Across Banking Cloud Environments
Introduction The banking industry is rapidly transitioning from traditional infrastructure models toward cloud-native, hybrid, and multi-cloud environments. Digital banking applications, payment platforms, lending systems, customer portals, fraud detection platforms, and financial analytics increasingly depend on cloud infrastructure to deliver scalable and reliable services. This transformation provides banks with greater flexibility, but it also introduces a … Continue reading “How AI-Driven FinOps and AIOps Improve Performance Across Banking Cloud Environments”
How to Optimize Telecom Database Infrastructure with Enteros Database Software, AIOps, and Cloud FinOps
Introduction Telecommunications companies operate some of the most complex technology environments in the world. Subscriber management, billing, charging, network inventory, service provisioning, CRM, usage analytics, 5G, IoT, edge computing, and digital customer platforms all generate massive database workloads. As telecom operators expand 5G, cloud-native architectures, edge computing, and AI, the amount and complexity of data … Continue reading “How to Optimize Telecom Database Infrastructure with Enteros Database Software, AIOps, and Cloud FinOps”
Building Resilient BFSI Applications with Predictive AIOps and FinOps Intelligence
- 23 August 2026
- Database Performance Management
Introduction The Banking, Financial Services, and Insurance (BFSI) industry is undergoing a rapid digital transformation. Mobile banking, digital payments, online lending, insurance platforms, wealth management applications, and real-time financial services now depend on highly available and scalable IT infrastructure. Customers expect BFSI applications to be fast, secure, and available around the clock. Even a short … Continue reading “Building Resilient BFSI Applications with Predictive AIOps and FinOps Intelligence”