Hi Everyone,
I have been trying to use case statements with oracle table type by really not sure how to go about it. I know it might be simple but it been giving me hard time. So please help gurus :-)
Here is my Cursor:
CURSOR c_chk_style IS
SELECT DISTINCT 1
FROM TABLE(CAST(I_message.ExtOfXOrderDesc_TBL(1).ExtOfXOrderSkuDesc_TBL AS "RIB_ExtOfXOrderSkuDesc_TBL")) item_diff,
TABLE(CAST(I_message.ExtOfXOrderDesc_TBL(1).ExtOfXOrderPackDesc_TBL AS "RIB_ExtOfXOrderPackDesc_TBL")) pack_diff
WHERE (EXISTS (SELECT 1
FROM item_master im
WHERE im.item = item_diff.style_no
AND im.item_level=1)
OR
EXISTS (SELECT 1
FROM item_master im
WHERE im.item = pack_diff.style_no
AND im.item_level=1)
);
Now i know that the table type "RIB_ExtOfXOrderSkuDesc_TBL" will be always populated but the table type "RIB_ExtOfXOrderPackDesc_TBL" may not be populate and can be null. So i want to run the exists against the "RIB_ExtOfXOrderPackDesc_TBL" aliased pack_diff only if it is populated. If its null i dont want to run the exists clause. Could anyone please help.