--没有主键的表
select table_name
from user_tables a
where not exists (select *
from user_constraints b
where b.constraint_type = 'P'
and a.table_name = b.table_name)
--SYS开头的
select table_name
from user_tables a
where not exists (select *
from user_constraints b
where b.constraint_type = 'P'
and a.table_name = b.table_name)
and table_name LIKE 'SYS%'
--不是SYS开头的
select table_name
from user_tables a
where not exists (select *
from user_constraints b
where b.constraint_type = 'P'
and a.table_name = b.table_name)
and table_name NOT LIKE 'SYS%'
--所有空表
select table_name from all_all_tables where owner='MDM' AND num_rows ='0'
--所有非空表且不是SYS开头
SELECT x.* FROM (select table_name
from user_tables a
where not exists (select *
from user_constraints b
where b.constraint_type = 'P'
and a.table_name = b.table_name)
and table_name NOT LIKE 'SYS%')x LEFT JOIN (select table_name from all_all_tables where owner='MDM' AND num_rows ='0')y ON x.table_name = y.table_name
WHERE y.table_name IS NULL
--所有不是SYS开头的空表
SELECT x.* FROM (select table_name
from user_tables a
where not exists (select *
from user_constraints b
where b.constraint_type = 'P'
and a.table_name = b.table_name)
and table_name NOT LIKE 'SYS%')x LEFT JOIN (select table_name from all_all_tables where owner='MDM' AND num_rows ='0')y ON x.table_name = y.table_name
WHERE y.table_name IS not null