{データベースの作成その他}制約名を変更

 

https://docs.oracle.com/cd/F19136_01/sqlrf/ALTER-TABLE.html


drop table tab1 purge;
drop table tab2 purge;

create table tab1(col1 int, col2 int);
create table tab2(col1 int, col2 int, col3 int);


alter table tab1 add constraint pk1 primary key(col1);
alter table tab2 add constraint pk2 primary key(col1,col2);


select * from user_constraints where table_name like 'TAB%' and constraint_type = 'P';

alter table tab1 rename constraint pk1 to pk11;
alter table tab2 rename constraint pk2 to pk21;