CREATE PROCEDURE tsdropall3(); define drop_wt integer; define drop_vt integer; let drop_wt = 0; let drop_vt = 0; select count(*) into drop_wt from systables where tabname not in ('tscontainerwindowtable') and tabid in (select tabid from syscolumns where extended_id in (select extended_id from sysxtdtypes where type = ( select type from sysxtdtypes where name = 'timeseries') ) ); select count(*) into drop_vt from systables where tabname not in ('tscontainerusageactivewindowvti','tscontainerusagedormantwindowvti') and am_id in (select am_id from sysams where am_name = 'ts_vtam'); if (drop_wt = 0 and drop_vt = 0) then drop table TSContainerUsageActiveWindowVTI; drop table TSContainerUsageDormantWindowVTI; drop table tscontainerwindowtable; end if; END PROCEDURE; EXECUTE PROCEDURE tsdropall3(); DROP PROCEDURE tsdropall3();