Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> rollup not working

rollup not working

From: UNIXNewBie <nospan_at_nospam.com>
Date: Wed, 25 Feb 2004 19:02:29 -0500
Message-ID: <1KednaVlHdAXqqDdRVn-gw@magma.ca>

Am looking at an Oracle SQL reference book.

They have the following SQL for ROLLUP which works

SELECT 0.YEAR, TO_CHAR(TO_DATE(O.MONTH, 'MM'), 'Month') MONTH,

R.NAME REGION, SUM(O.TOT_SALES) FROM ORDERS O, REGION R WHERE R.REGION_ID = O.REGION_ID AND O.MONTH BETWEEN 1 AND 3 GROUP BY ROLLUP (O.YEAR, O.MONTH, R.NAME) They also have the following SQL which apparently is supposed to produce a partial ROLLUP. It does not work however. I receive ORA-00933: SQL command not properly ended.

Why is this happening?

Note that the only difference is that O.YEAR is now outside the ROLLUP

SELECT O.YEAR, TO_CHAR(TO_DATE(O.MONTH, 'MM'), 'Month') MONTH,

R.NAME REGION, SUM(O.TOT_SALES) FROM ORDERS O, REGION R WHERE R.REGION_ID = O.REGION_ID AND O.MONTH BETWEEN 1 AND 3 GROUP BY O.YEAR, O.MONTH ROLLUP (R.NAME) Received on Wed Feb 25 2004 - 18:02:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US