Last active
January 28, 2019 12:34
-
-
Save BenjaminHerbert/abcbb78c419cedd73826e32287e6107e to your computer and use it in GitHub Desktop.
Remove unnamed column constraint from a table in Oracle (Helpful link: https://stackoverflow.com/questions/5903632/can-a-subquery-be-used-in-an-oracle-alter-statement)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
stmt VARCHAR2(2000); | |
constr_name VARCHAR2(30); | |
BEGIN | |
SELECT CONSTRAINT_NAME INTO constr_name | |
FROM USER_CONS_COLUMNS | |
WHERE table_name = 'YOUR_TABLE' AND | |
column_name = 'YOUR_CONSTRAINED_COLUMN'; | |
stmt := 'ALTER TABLE YOUR_TABLE DROP CONSTRAINT '|| constr_name; | |
EXECUTE IMMEDIATE(stmt); | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment