How to handle subquery in IF statement
851804Nov 11 2011 — edited Nov 14 2011My original query is as follows:
IF rec.desp_ctr IN ('067') THEN
ln_qty := rec.prt_ord;
ELSIF rec.desp_ctr IN ('040','041','043') THEN
ln_qty := rec.qty;
END IF;
I need to modify the query and make it generic so as to handle more values. Something like-
IF rec.desp_ctr IN ('067') THEN
ln_qty := rec.prt_ord;
ELSIF rec.desp_ctr IN (SELECT DISTINCT(T1.RP_CD_PLANT) FROM V_RECEIVING_PLANT t1
WHERE T1.RP_CD_COMPANY = '1000'
AND T1.RP_CD_STATUS = 'A') THEN
ln_qty := rec.qty;
END IF;
The above returns an error saying that subquery is not allowed in this context. How else can I make my code generic so as to handle all records coming from V_RECEIVING_PLANT.
URGENT. Please help.