The following lines contain the word 'select', 'insert', 'update' or 'delete':
execute immediate 'select bitand(flags, 128) from coltype$ where
obj#=(select obj# from obj$ where name=''KOTTD$'' and owner#=0)' into oldimg;
execute immediate 'select count(*) from kottd$' into origcnt;
execute immediate 'insert into kottd_temp$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottd$';
execute immediate 'update coltype$ set flags=flags-bitand(flags,128)
where obj#=(select obj# from obj$ where name=''KOTTD$'' and owner#=0)';
execute immediate 'begin insert into kottd$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottd_temp$;
execute immediate 'delete from kottd$';
execute immediate 'begin insert into kottd$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottd_temp$;
execute immediate 'select count(*) from kottd$' into inscnt;
execute immediate 'insert into kottb_temp$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottb$';
execute immediate 'select count(*) from kottb$' into origcnt;
execute immediate 'update coltype$ set flags=flags-bitand(flags,128)
where obj#=(select obj# from obj$ where name=''KOTTB$'' and owner#=0)';
execute immediate 'begin insert into kottb$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottb_temp$ ; exception when
execute immediate 'delete from kottb$';
execute immediate 'begin insert into kottb$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottb_temp$ ; exception when
execute immediate 'select count(*) from kottb$' into inscnt;
execute immediate 'insert into kottbx_temp$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottbx$';
execute immediate 'select count(*) from kottbx$' into origcnt;
execute immediate 'update coltype$ set flags=flags-bitand(flags,128)
where obj#=(select obj# from obj$ where name=''KOTTBX$'' and owner#=0)';
execute immediate 'begin insert into kottbx$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottbx_temp$ ; exception when
execute immediate 'delete from kottbx$';
execute immediate 'begin insert into kottbx$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottbx_temp$ ; exception when
execute immediate 'select count(*) from kottbx$' into inscnt;
execute immediate 'insert into kotad_temp$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kotad$';
execute immediate 'select count(*) from kotad$' into origcnt;
execute immediate 'update coltype$ set flags=flags-bitand(flags,128)
where obj#=(select obj# from obj$ where name=''KOTAD$'' and owner#=0)';
execute immediate 'begin insert into kotad$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kotad_temp$; exception when others
execute immediate 'delete from kotad$';
execute immediate 'begin insert into kotad$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kotad_temp$; exception when others
execute immediate 'select count(*) from kotad$' into inscnt;
execute immediate 'insert into kotmd_temp$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kotmd$';
execute immediate 'select count(*) from kotmd$' into origcnt;
execute immediate 'update coltype$ set flags=flags-bitand(flags,128)
where obj#=(select obj# from obj$ where name=''KOTMD$'' and owner#=0)';
execute immediate 'begin insert into kotmd$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kotmd_temp$; exception when others
execute immediate 'delete from kotmd$';
execute immediate 'begin insert into kotmd$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kotmd_temp$; exception when others
execute immediate 'select count(*) from kotmd$' into inscnt;
procedure delete_orphan_typeidcols
is
objno number;
select distinct c.obj#, c.intcol# from col$ c, coltype$ t where
bitand(c.property, 33554432)=33554432 and c.obj#=t.obj# and
c.intcol# not in (select typidcol# from coltype$ t1 where c.obj#=t1.obj# and
typidcol# is not null);
DELETE from col$ where obj#=objno and intcol#=intcolno;
end; /* end of delete_orphan_typeidcols */
execute immediate 'select bitand(flags, 128) from coltype$ where
obj#=(select obj# from obj$ where name=''KOTTD$'' and owner#=0)' into oldimg;
execute immediate 'update coltype$ set flags=flags+128
where obj#=(select obj# from obj$ where name=''KOTTD$'' and owner#=0)';
execute immediate 'insert into kottd_temp$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottd$ where sys_nc_oid$=''00000000000000000000000000000044'' or sys_nc_oid$=''00000000000000000000000000000045'' or sys_nc_oid$=''00000000000000000000000000000046''';
execute immediate 'delete from kottd$ where sys_nc_oid$=''00000000000000000000000000000044'' or sys_nc_oid$=''00000000000000000000000000000045'' or sys_nc_oid$=''00000000000000000000000000000046''';
execute immediate 'update coltype$ set flags=flags-128
where obj#=(select obj# from obj$ where name=''KOTTD$'' and owner#=0)';
execute immediate 'insert into kottd$(sys_nc_oid$, sys_nc_rowinfo$)
select sys_nc_oid$, sys_nc_rowinfo$ from kottd_temp$ where sys_nc_oid$=''00000000000000000000000000000044'' or sys_nc_oid$=''00000000000000000000000000000045'' or sys_nc_oid$=''00000000000000000000000000000046''';