Solved

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

Posted on 2009-05-11
2
1,038 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 143

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 143

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Repeat query 13 74
Include a logo in email body using Oracle utl_mail 11 54
create a nested synonym 4 40
running myfile.SQL from command line SQLPLUS 12c does not exit. 7 35
Note: You must have administrative privileges in order to create/edit Roles. Salesforce.com (http://www.salesforce.com/) (SFDC) is a cloud-based customer relationship management (CRM) system. It is a database most commonly used by sales and markeā€¦
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

756 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