Home » Developer & Programmer » JDeveloper, Java & XML » missing expression and then group function not allowed error (jdeveloper 11g)
missing expression and then group function not allowed error [message #496009] Wed, 23 February 2011 12:41 Go to next message
luron234
Messages: 2
Registered: February 2011
Junior Member
Hello, I am wondering what I am doing wrong. I have 2 tables used in this problem: ODETAILS and ORDERS.
ODETAILS has the following columns: ONO, PNO, QTY, COST

ORDERS has the following columns: ONO, CNO, ENO, RECEIVED, SHIPPED, ORDER_COST
UPDATE ORDERS
SET ORDER_COST= 1 * ( select SUM(
        SELECT COST
        FROM ODETAILS
        WHERE ORDERS.PNO=ODETAILS.PNO
        )
    );



In ODETAILS there can be more than 1 row for 1 order. So I'm trying to add all the COSTs in ODETAILS.
Re: missing expression and then group function not allowed error [message #496012 is a reply to message #496009] Wed, 23 February 2011 13:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
add

ORDER_COST= 1 * ( 

This is not "add".

Quote:
I am wondering what I am doing wrong.

If you post why you think you're doing something wrong maybe we can understand what you're trying to do and help you to correct the statement.

Regards
Michel
Re: missing expression and then group function not allowed error [message #496014 is a reply to message #496012] Wed, 23 February 2011 14:05 Go to previous messageGo to next message
luron234
Messages: 2
Registered: February 2011
Junior Member
I am trying to add all the COSTs in odetails together where the Ono is the same
Re: missing expression and then group function not allowed error [message #496015 is a reply to message #496014] Wed, 23 February 2011 14:09 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
UPDATE ORDERS
SET ORDER_COST= (select SUM(COST)
        FROM ODETAILS
        WHERE ORDERS.PNO=ODETAILS.PNO
    );

Regards
Michel
Previous Topic: java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
Next Topic: dynamic xml composition
Goto Forum:
  


Current Time: Thu Mar 28 06:41:58 CDT 2024