Посмотреть индексы в базе — различия между версиями

Материал из wiki.standart-n.ru
Перейти к: навигация, поиск
 
Строка 18: Строка 18:
 
           and R.RDB$RELATION_NAME not starting with 'MON$'
 
           and R.RDB$RELATION_NAME not starting with 'MON$'
 
     order by R.RDB$RELATION_NAME asc
 
     order by R.RDB$RELATION_NAME asc
     into :table_name
+
     into :TABLE_NAME
 
  do
 
  do
 
  begin
 
  begin
 
   for select I.RDB$INDEX_NAME,
 
   for select I.RDB$INDEX_NAME,
 +
            I.RDB$UNIQUE_FLAG,
 
             I.RDB$INDEX_INACTIVE
 
             I.RDB$INDEX_INACTIVE
 
       from RDB$INDICES I
 
       from RDB$INDICES I
 
       where 1 = 1
 
       where 1 = 1
             and I.RDB$RELATION_NAME = :table_name
+
             and I.RDB$RELATION_NAME = :TABLE_NAME
 
       order by I.RDB$INDEX_NAME asc
 
       order by I.RDB$INDEX_NAME asc
 
       into :NAME,
 
       into :NAME,
           :inactive_status
+
           :UNIQUE_STATUS,
 +
          :INACTIVE_STATUS
 
   do
 
   do
 
   suspend;
 
   suspend;

Текущая версия на 18:00, 18 мая 2016

Процедура

SET TERM ^ ;

create or alter procedure PR_GET_INDICES_LIST
returns (
    TABLE_NAME DM_TEXT,
    NAME DM_TEXT,
    INACTIVE_STATUS DM_ID_NULL)
as
begin

 for select R.RDB$RELATION_NAME
     from RDB$RELATIONS R
     where 1 = 1
           and R.RDB$RELATION_NAME not starting with 'VW_'
           and R.RDB$RELATION_NAME not starting with 'RDB$'
           and R.RDB$RELATION_NAME not starting with 'MON$'
     order by R.RDB$RELATION_NAME asc
     into :TABLE_NAME
 do
 begin
  for select I.RDB$INDEX_NAME,
             I.RDB$UNIQUE_FLAG,
             I.RDB$INDEX_INACTIVE
      from RDB$INDICES I
      where 1 = 1
            and I.RDB$RELATION_NAME = :TABLE_NAME
      order by I.RDB$INDEX_NAME asc
      into :NAME,
           :UNIQUE_STATUS,
           :INACTIVE_STATUS
  do
   suspend;
 end

end^

SET TERM ; ^

/* Existing privileges on this procedure */

GRANT EXECUTE ON PROCEDURE PR_GET_INDICES_LIST TO SYSDBA;