declare indice_nao_existe exception; pragma exception_init (indice_nao_existe , -01418); begin execute immediate 'DROP INDEX TARIFA_UNICA'; exception when indice_nao_existe then null; end; / declare column_exists exception; pragma exception_init (column_exists , -00001); begin execute immediate 'CREATE UNIQUE INDEX UNQ_TARIFA ON TARIFA (CASE WHEN ACTIVO = 1 THEN TRAMO_ID || MARCA_ID || CLASESERVICIO_ID || MONEDA_ID || VIGENCIATARIFA_ID || ORGAOCONCEDENTE_ID || RUTA_ID ELSE NULL END)'; exception when column_exists then null; end; /