我在下面找到了解决方案,但我需要使用 PL/SQL 存储过程来完成。
declare
l_nullable varchar2(1);
begin
select nullable into l_nullable
from user_tab_columns
where table_name = 'PV_REPORT_DETAILS'
and column_name = 'FEED_ID';
if l_nullable = 'Y' then
execute immediate 'alter table PV_REPORT_DETAILS modify (Feed_ID not null)';
end if;
select nullable into l_nullable
from user_tab_columns
where table_name = 'PV_REPORT_DETAILS'
and column_name = 'CURRENT_RUN_ID';
if l_nullable = 'Y' then
execute immediate 'alter table PV_REPORT_DETAILS modify (Current_Run_ID not null)';
end if;
select nullable into l_nullable
from user_tab_columns
where table_name = 'PV_REPORT_DETAILS'
and column_name = 'PREVIOUS_RUN_ID';
if l_nullable = 'Y' then
execute immediate 'alter table PV_REPORT_DETAILS modify (Previous_Run_ID not null)';
end if;
end;