Hi was wondering if you are allowed to output a group function such as SUM
from a cursor. For example:
[CODE=oracle]
DECLARE
cursor customer_total_ owing IS
SELECT c_first, c_last, SUM(inventory.i nv_price * order_line.ol_q uantity)
FROM customer, orders, order_line, inventory
WHERE customer.c_id = orders.c_id
AND orders.o_id = order_line.o_id
AND order_line.inv_ id = inventory.inv_i d
GROUP BY c_first, c_last;
customer_owing_ row customer_total_ owing%rowtype;
BEGIN
FOR customer_owing_ row IN customer_total_ owing
LOOP
DBMS_OUTPUT.PUT _LINE(customer_ owing_row.c_fir st || customer_owing_ row.c_last || ' $' || customer_owing_ row.SUM(invento ry.inv_price * order_line.ol_q uantity));
END LOOP;
END;
[/CODE]
Im having trouble outputing the group function customer_owing_ row.SUM(invento ry.inv_price * order_line.ol_q uantity));.
*customer_owing _row is a %rowtype of the cursor which has the group function.
The error i get:
ORA-06550: line 17, column 110:
PLS-00302: component 'SUM' must be declared.
So can i output this function or is there some other way to do it?
from a cursor. For example:
[CODE=oracle]
DECLARE
cursor customer_total_ owing IS
SELECT c_first, c_last, SUM(inventory.i nv_price * order_line.ol_q uantity)
FROM customer, orders, order_line, inventory
WHERE customer.c_id = orders.c_id
AND orders.o_id = order_line.o_id
AND order_line.inv_ id = inventory.inv_i d
GROUP BY c_first, c_last;
customer_owing_ row customer_total_ owing%rowtype;
BEGIN
FOR customer_owing_ row IN customer_total_ owing
LOOP
DBMS_OUTPUT.PUT _LINE(customer_ owing_row.c_fir st || customer_owing_ row.c_last || ' $' || customer_owing_ row.SUM(invento ry.inv_price * order_line.ol_q uantity));
END LOOP;
END;
[/CODE]
Im having trouble outputing the group function customer_owing_ row.SUM(invento ry.inv_price * order_line.ol_q uantity));.
*customer_owing _row is a %rowtype of the cursor which has the group function.
The error i get:
ORA-06550: line 17, column 110:
PLS-00302: component 'SUM' must be declared.
So can i output this function or is there some other way to do it?
Comment