THe bussiness rule is as such: The orderlines must be updated with a date stamp when all the related orderlines are marked as 'Y' denoting a completed order line.
THe trigger thus far is:
CREATE OR REPLACE TRIGGER orderComplete
after update ON orderline
DECLARE
orderId NUMBER;
ordersNotDone NUMBER;
BEGIN
SELECT COUNT(Orderline_fulfilled), order_id INTO ordersNotDone, orderId
FROM orderHeader
JOIN orderline ON
orderHeader.Order_id = orderLine.Orderline_order
WHERE Order_id = orderline_order
AND orderline_fulfilled = 'N'
GROUP BY order_id;
if ordersNotDone = 0
then
UPDATE orderHeader
set ORDER_COMPLETED = sysdate
WHERE order_id = orderId;
end if;
END;
Upon an update of the order line, an 'no data found' is returned- is this sugesting the orderId variable is not returning data? The queries do work, however, when taken out of the trigger and ran independently.
