Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

860 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