Preamble
Oracle CURSOR – When dealing with cursors, you will need to determine your cursor status. Below is a list of cursor attributes that you can use.
| Attributes | Explanation |
| %ISOPEN | – Returns TRUE if the cursor is open, returns FALSE if the cursor is closed. |
| %FOUND | – Returns INVALID_CURSOR if the cursor is declared but not opened; or if the cursor was closed. – Returns NULL if the cursor is open but the selection was not made. – If finished the selection successfully, it returns TRUE. – If no lines are returned, returns FALSE. |
| %NOTFOUND | – Returns INVALID_CURSOR if the cursor is declared but not opened; or if the cursor was closed. – Return NULL if the cursor is open but the selection was not made. – Returns FALSE if the selection was successfully completed. – Returns TRUE if no lines are returned. |
| %ROWCOUNT | – Returns INVALID_CURSOR if the cursor is declared but not opened; or if the cursor was closed. – Returns the number of rows to be returned. – The ROWCOUNT attribute does not give a real number of rows until you pass the entire cursor. In other words, you don’t have to rely on this attribute to tell how many rows a cursor has after it has opened. |
Here is an example of how the Oracle % NOTFOUND attribute can be used.
CREATE OR REPLACE Function FindCourse
( name_in IN varchar2 )
RETURN number
IS
cnumber number;
CURSOR c1
IS
SELECT course_number
FROM courses_tbl
WHERE course_name = name_in;
BEGIN
open c1;
fetch c1 into cnumber;
if c1%notfound then
cnumber := 9999;
end if;
close c1;
RETURN cnumber;
END;
Cursors in Oracle PLSQL
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
Boosting Digital Transformation Success with Intelligent Database Performance Analytics
- 5 June 2026
- Database Performance Management
Introduction Digital transformation has become a strategic priority for organizations across every industry. From financial services and healthcare to retail, manufacturing, and technology, businesses are investing heavily in cloud computing, data-driven decision-making, artificial intelligence (AI), automation, and customer-centric digital experiences. The goal is clear: improve agility, enhance operational efficiency, increase competitiveness, and deliver exceptional customer … Continue reading “Boosting Digital Transformation Success with Intelligent Database Performance Analytics”
How AI-Driven AIOps Helps Enterprises Detect and Resolve Database Anomalies Faster
Introduction Modern enterprises depend on databases to power virtually every critical business function, from customer-facing applications and e-commerce platforms to financial systems, healthcare services, and cloud-native workloads. As digital transformation accelerates, organizations are generating unprecedented volumes of data and managing increasingly complex database environments spread across on-premises infrastructure, public clouds, hybrid architectures, and distributed systems. … Continue reading “How AI-Driven AIOps Helps Enterprises Detect and Resolve Database Anomalies Faster”
The Future of Autonomous Database Performance Management in Cloud-Native Environments
- 4 June 2026
- Database Performance Management
Introduction As organizations accelerate their digital transformation initiatives, cloud-native architectures have become the foundation of modern application development. Businesses increasingly rely on microservices, containers, Kubernetes, hybrid cloud deployments, and distributed databases to deliver scalable, resilient, and high-performing digital experiences. While cloud-native environments offer tremendous flexibility and scalability, they also introduce unprecedented complexity. Modern applications generate … Continue reading “The Future of Autonomous Database Performance Management in Cloud-Native Environments”
Improving Enterprise Application Reliability with Proactive Database Observability
Introduction Enterprise applications are the backbone of modern organizations. Whether supporting customer-facing digital services, financial transactions, e-commerce operations, supply chain management, healthcare systems, or internal business processes, application performance directly impacts customer satisfaction, operational efficiency, and revenue generation. However, as enterprise environments become increasingly complex, maintaining application reliability has become a significant challenge. Modern applications … Continue reading “Improving Enterprise Application Reliability with Proactive Database Observability”