DECLARE str VARCHAR2(4000);
BEGIN
for x in (
select * from (
SELECT distinct (M.guid ),
M.physycaltable,
M.year,
N.columncode
FROM p#busfw_t_dctable M
left join p#busfw_t_dccolumn N on N.tablecode =M.tablecode
)
where columncode = ‘IS_DELETED’ and year =‘2022’ and physycaltable is not NULL
) loop
str:='alter table '||x.physycaltable || ' alter column ' || x.columncode ||' set default 2 ; ';
dbms_output.put_line(str);
end loop;
end;