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);
alter table tab2 add constraint fk21 foreign key (col1) references tab1(col1);
select * from user_constraints where table_name like 'TAB%' and constraint_type = 'P';
select * from user_constraints where table_name like 'TAB%' and constraint_type = 'R';