| parth |
Posted: Jun 19, 2007 06:52:21 AM |
Total Post: 17
Joined: Apr, 2007
|
hi
i want a result like below:
fir sec
-----------------------------
10 10
20 30
30 60
40 100
please add like above and tell, once i have read about some function for that but cant remember it...!
if any one can !?
parth |
|
|
chinna |
| Posted: Jun 20, 2007 05:03:28 AM | |
|
Total Post: 28
Joined: May, 2007
|
HI,
Iam very happy if this explanation helps you.
Intially frequency table with freq column and cfreq(with empty) column
FREQ CFREQ
---- ----------
10
20
30
40
70
15
35
after executing the procedure
EXEC CUMMULATIVE_FREQUENCY
FREQ CFREQ
---- ----------
10 10
20 30
30 60
40 100
70 170
15 185
35 220
----------------------------
PROCEDURE
-----------------------------
V_RES NUMBER(4);
V_RES2 NUMBER(4):=0;
CURSOR C1 IS SELECT FREQ FROM FREQUENCY;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO V_RES ;
EXIT WHEN C1%NOTFOUND;
V_RES2:=V_RES2+V_RES;
EXECUTE IMMEDIATE 'UPDATE FREQUENCY SET CFREQ=:1 WHERE FREQ=:2' USING V_RES2,V_RES;
END LOOP;
CLOSE C1;
------------------------------------------------------------
REGARDS
SRAWAN
|
|
|
|
|
parth |
| Posted: Jun 21, 2007 07:58:05 AM | |
|
Total Post: 17
Joined: Apr, 2007
|
hi srawan thanx but my question here is, if you dont have any column rather then "Freq" column means no Cfreq column then, above all i dont want to use th procedure for that. so if you can help with the query please...
I am traying to doing it with the Self Join but it seems quite difficult to do,
thanks any ways
chao
~Parth
|
|
|
|
|
Vijay |
| Posted: Jul 16, 2007 02:16:19 AM | |
|
Total Post: 12
Joined: Jul, 2007
|
Hi Parth/Srawan,
There are aggregate functions ROLLUP and CUBE in Oracle.
To get the summary details. You can develop logic to get the cummulative result in there.
Regards.
Vijay Mahawar.
|
|
|
|
|
chinna |
| Posted: Jul 18, 2007 06:43:53 AM | |
|
Total Post: 28
Joined: May, 2007
|
hi,
here is the reqired query for cummulative frequency,.according to my view.
select deptno,sum(deptno) over(order by deptno) "cummulative frequency" from dept
try this.
take care
ok byeeeeeeeeeeeeee
regards
srawan
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |