Search code examples
sqloracle-databaseoracle11gsumcube

SQL: cube function incorrectly terminated


Simple syntax error using Oracle 11g. With the following SQL statement:

SELECT employee, CUST_NBR,
SUM (SALE_PRICE)
FROM CUST_ORDER
GROUP BY employee, CUST_NBR WITH CUBE

For the table CUST_ORDER (*ORDER_ID, employee, SALE_PRICE, CUST_NBR)

Oracle complains that

ERROR at line 4: ORA-00933: SQL command not properly ended

I am probably being blind, but I can't see the problem


Solution

  • You should use

    GROUP BY CUBE(employee, CUST_NBR)
    

    More on CUBE here.