473,503 Members | 9,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rollup not working

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)

Jul 19 '05 #1
2 5283
"UNIXNewBie" <no****@nospam.com> wrote in message news:<1K********************@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)


I spot a , missing between O.MONTH and rollup

Apart from that you really need to include your version in every post.
This is an area which has been improved several times, so you might
just be using the newest syntax against an older version of the
database (or set your compatible parameter incorrectly)

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
That was it.

Thanks for the tip on the version. I'll remember that for next time.

This was Oracle 9.2
<sy******@yahoo.com> wrote in message
news:a1**************************@posting.google.c om...
"UNIXNewBie" <no****@nospam.com> wrote in message

news:<1K********************@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)


I spot a , missing between O.MONTH and rollup

Apart from that you really need to include your version in every post.
This is an area which has been improved several times, so you might
just be using the newest syntax against an older version of the
database (or set your compatible parameter incorrectly)

Sybrand Bakker
Senior Oracle DBA

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7529
by: Burt | last post by:
MS has been nice enough to add the Cube and Rollup operators so I can have totals with my results. But out of shear meanness they won't let me use them unless I use a Group By clause in my...
1
5360
by: Frank Py | last post by:
I found this great rollup query example that uses grouping and sub totals. Would it be possible to expand on this and include a group within a group and subtotal each group? For example, parent...
1
2536
by: c.le_roq | last post by:
Hello, Using rollup I want to count the number of rows of a table called Table1 which is LEFT JOINED with a table called Table2. The problem is that we can have more than 1 rows in Table2 that...
1
1546
by: js | last post by:
I have a SQL Server 2003 stored procedure that uses "select ... group by ... with rollup" syntax. The total of columns from the query varies from 3 to 4. The query returns several rollup...
3
4824
by: apattin | last post by:
Hi all, I need some expert advice on a ROLLUP fine point. summary_table table has 4 columns: file_id primary_site morphology primary
0
3754
by: Ike | last post by:
When I use "With rollup," I am getting totals on columns which are numeric, however, non-numeric columns are copying down to the rollup column (i.e. the last column's non-numeric columns are being...
1
3463
by: vanandwiz | last post by:
Please find the code below. SELECT COMPANY.NAME, COUNT(ITEM.ID) FROM ITEM, COMPANY WHERE ITEM.COMPANYID = COMPANY.ID GROUP BY ROLLUP(COMPANY.NAME)
3
4257
by: traceable1 | last post by:
I installed the SQL Server 2005 SP2 update 2 rollup on my 64-bit server and the performance has tanked! I installed rollup 3 on some of them, but that did not seem to help. I thought it...
2
184
by: UNIXNewBie | last post by:
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)...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.