Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1055
  • Last Modified:

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

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

Thanks!
0
Hoboly
Asked:
Hoboly
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you might want to change it to add a schema as parameter ... (in my database, that was not needed)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now