single-row subquery error
I'm having a hard time trying to find the problem in the following query:
UPDATE vod_preinvoices_export_t vpet
SET bonus =
(
SELECT nvl(SUM(ebit.amount), 0)
FROM event_t et, event_bal_impacts_t ebit, item_t it
WHERE it.bill_obj_id0 = vpet.preinvoice_id
AND et.item_obj_id0 = it.poid_id0
AND ebit.obj_id0 = et.poid_id0
AND ebit.resource_id = 978
AND et.poid_type like '/event/activity/cycle/fold%'
AND ebit.impact_category = 'PriceCategory1'
)
WHERE vpet.partner_id = 'partner'
AND vpet.contract_id = 15507
AND vpet.preinvoice_id = 12756
AND vpet.price_category = '15';
When I execute the select by itself I just get one row as a result (as you can see I'm doing a SUM). But I'm getting the error:
ORA-01427: single-row subquery returns more than one row
Does anyone know what could be the problem in the query above?
Many thanks
Lorenzo Santacana