-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrowth_Object_Func.sql
28 lines (25 loc) · 1.45 KB
/
Growth_Object_Func.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE OR REPLACE FUNCTION DATADK.Genel_Buyume(tbs_name varchar2)
return varchar2
IS
deger varchar2(100);
cursor cursor_tbs IS
select thedate, mbsize - prev_mbsize
from (select thedate, mbsize, lag(mbsize, 1) over(order by r) prev_mbsize
from (select rownum r, thedate, mbsize
from (select trunc(thedate) thedate, max(mbsize) mbsize
from (select to_date(to_char(snapshot.begin_interval_time,'YYYY-MON-DD HH24:MI:SS'),'YYYY-MON-DD HH24:MI:SS') thedate,
round((usage.tablespace_usedsize * block_size.value) / 1024 / 1024 ,2) mbsize
from dba_hist_tbspc_space_usage usage,v$tablespace tablespace,dba_hist_snapshot snapshot,v$parameter block_size
where usage.snap_id = snapshot.snap_id
and usage.tablespace_id = tablespace.ts#
and tablespace.name =tbs_name
and block_size.name = 'db_block_size')
group by trunc(thedate)
order by trunc(thedate))));
BEGIN
for i in cursor_tbs
loop
deger:='Tarih' || i.thedate || 'Boyut' || i.mbsize-prev_mbsize
return deger;
end loop;
END Genel_Buyume;