Check whether the table in the oralce database has a primary key (primary key)
declare pkCount number; --表中主键数量
begin
for v_ref in (select t.TABLE_NAME from user_tables t) loop
select count(1) into pkCount from user_constraints c where c.TABLE_NAME = v_ref.TABLE_NAME;
if pkCount = 0 then
dbms_output.put_line(v_ref.TABLE_NAME);--打印没有设置主键的表名称
end if;
end loop;
exception
when others then
dbms_output.put_line(SQLCODE || ' ' || SQLERRM);
end;