Solved

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

Posted on 2009-05-11
2
1,032 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
ID: 24352236
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]
ID: 24352239
you might want to change it to add a schema as parameter ... (in my database, that was not needed)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Read about achieving the basic levels of HRIS security in the workplace.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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.
This video shows how to recover a database from a user managed backup

912 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

16 Experts available now in Live!

Get 1:1 Help Now