Skip to main content
1 de 2

Se você estiver utilizando PL-SQL no seu script, pode resolver desta maneira:

DECLARE
  CURSOR C_CONSTRAINT IS
    SELECT CONSTRAINT_NAME 
      FROM user_cons_columns 
     WHERE COLUMN_NAME = 'CANCELAMENTO' 
       AND table_name = 'NAVIO';       
  V_CONSTRAINT C_CONSTRAINT%ROWTYPE;       
BEGIN    
    OPEN C_CONSTRAINT;
    LOOP
      FETCH C_CONSTRAINT INTO V_CONSTRAINT;
      EXIT WHEN C_CONSTRAINT%NOTFOUND;
      EXECUTE 'ALTER TABLE NAVIO DROP CONSTRAINT' || V_CONSTRAINT.CONSTRAINT_NAME;
    END LOOP;
END;