--drop index se existe
DECLARE
itemExists NUMBER;
BEGIN
     itemExists := 0;

SELECT COUNT(INDEX_NAME) INTO itemExists
FROM ALL_INDEXES
WHERE UPPER(INDEX_NAME) LIKE UPPER('PRECIO_VENTAJA__UN');


IF itemExists > 0 THEN
begin   
    EXECUTE IMMEDIATE 'drop index PRECIO_VENTAJA__UN';
    EXECUTE IMMEDIATE 'ALTER TABLE PRECIO_VENTAJA ADD CONSTRAINT PRECIO_VENTAJA_PK PRIMARY KEY (PRECIOVENTAJA_ID )';
    exception when others then null;
end;
END IF;

END;


