SQL Language (MOSC)

MOSC Banner

histogram function with actual bucket boundary

edited Dec 20, 2010 9:53AM in SQL Language (MOSC) 3 commentsAnswered
 Hi,
Is there anyway to get histogram function with actual bucket boundary? I have a query like this.

SELECT row_size, Count(*) frequency FROM    (
SELECT WIDTH_BUCKET (Nvl(VSize(table_name),0)+1,0,30,3) row_size
  FROM user_tables
) GROUP BY row_size ORDER BY row_size

ROW_SIZE FREQUENCY
       1       110
       2         6


But I would rather the result set to be

ROW_SIZE FREQUENCY
      20       110
      30         6


I know the following can do it.

SELECT    row_size, Count(*) frequency FROM    (
SELECT 10 * Round((Nvl(VSize(table_name),0)+1)/ 20)+20 row_size
  FROM user_tables
) GROUP BY row_size  ORDER BY row_size

However, I would like to have a oracle built-in function to achieve the same. Any input?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center