declare
col_name varchar2(30);
begin
for r in (
select
table_name,
search_condition
from
user_tables t join
user_constraints c using (table_name)
where
table_name like 'T\_%' escape '\' and
c.constraint_type = 'C'
) loop
if r.search_condition like '% IS NOT NULL' then
col_name := regexp_replace(r.search_condition, '"([^"]*)" IS NOT NULL', '\1');
dbms_output.put_line(col_name);
execute immediate 'alter table ' || r.table_name || ' modify ' || col_name || ' null';
else
dbms_output.put_line(r.search_condition);
end if;
end loop;
end;
/