問題を検索する(Oracle SQL)クエリがあります:(簡略化)
select a.date, (a.counter1 + c.counter) / (c.counter1 - a.counter1) percentdiferent
--daily table is agregated to ocupy less space and be faster when searching for the total counters for a day
from dailytable a
join (
--the nonaggregated table has values for each minute
select trunc(b.date) date, sum(counter1) counter1
from minutetable b
where trunc(b.datea) = a.date
group by trunc(b.date)
) c
on c.date = a.date and c.counter1 <> a.counter1
where percentdiferent > 5
これらの問題を修正するには、次の手順を実行する必要があります。
exec aggregate(tablename, date)
手順は頻繁に変更され、複数のテーブルがあります。のようなことをする方法はありますか
with checktables as (
--above code
)
select date
from checktables
group by date
if result > 0
for each result
exec aggregate(tablename,date)
show results
?