469,082 Members | 1,119 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

WIDTH_BUCKET Function

debasisdas
8,127 Expert 4TB
WIDTH_BUCKET:-
===============
THIS FUNCTION GROUPS ROWS OF THE RESULT SET INTO BUCKETS,BUT IT ATTEMPTS TO CREATE EQUIWIDTH BUCKETS.THIS FUNCTION CAN WORK ON NUMERIC OR DATE DATA TYPE,AND TAKES 4 PARAMETERS.
a)EXPRESSION THAT GENERATE THE BUCKETS.
b)THE VALUE USED AS THE START OF THE RANGE OF BUCKET NO 1.
c)THE VALUE USED AS THE END OF THE RANGE OF BUCKET NO N.
d)THE NUMBER OF BUCKETS TO CREATE(N).

Sample Ex#1
===============
Expand|Select|Wrap|Line Numbers
  1. SELECT DEPTNO,EMPNO,SUM(SAL) SALARY,WIDTH_BUCKET(SUM(SAL),1,3000,3)SAL_BUCKET
  2. FROM EMP
  3. GROUP BY DEPTNO,EMPNO 
  4. ORDER BY SAL_BUCKET;
Sample Ex#2
===============
Expand|Select|Wrap|Line Numbers
  1. SELECT DEPTNO,EMPNO,SUM(SAL) SALARY,WIDTH_BUCKET(SUM(SAL),1000,6000,3)
  2. SAL_BUCKET FROM EMP
  3. GROUP BY DEPTNO,EMPNO 
  4. ORDER BY SAL_BUCKET;
Jul 3 '07 #1
0 6039

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by domeceo | last post: by
5 posts views Thread by phil_gg04 | last post: by
2 posts views Thread by laredotornado | last post: by
2 posts views Thread by sushil | last post: by
8 posts views Thread by Olov Johansson | last post: by
3 posts views Thread by Beta What | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.