Solved

How to check whether a index exists in pl/sql?

Posted on 2009-05-11
2
1,031 Views
Last Modified: 2013-12-07
How to check whether a index exists in pl/sql?

Thanks!
0
Comment
Question by:Hoboly
  • 2
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
Comment Utility
I have this function:
create or replace FUNCTION isIndexExist(indexname IN VARCHAR2) RETURN  BOOLEAN
IS
i integer;
BEGIN
    select count(*)
    into i
	from user_indexes
	where upper(index_name)=trim(upper(indexname)); 
	if (i>=1) then
	   return TRUE;
	else
	  return FALSE;
	end if; 
END isIndexExist;

Open in new window

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
you might want to change it to add a schema as parameter ... (in my database, that was not needed)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Salesforce.com is a cloud-based customer relationship management (CRM) system. In this article, you will learn how to add and map custom lead and contact fields to your Salesforce instance.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now