/***Query to Item HSN Code from Base Table***/
SELECT reporting_code
--INTO v_hsn_code
FROM apps.jai_item_templ_hdr jith,
apps.jai_reporting_associations jra,
apps.jai_regimes jr
WHERE jith.template_hdr_id = jra.entity_id
AND jra.reporting_usage = 'LR'
--and jra.EFFECTIVE_FROM='01-JAN-2017'
AND jra.effective_to IS NULL
--and jra.REGIME_CODE='GST'
AND jr.regime_id = jra.regime_id
AND jr.regime_code = 'GST' ---Depen on setup
SELECT reporting_code
--INTO v_hsn_code
FROM apps.jai_item_templ_hdr jith,
apps.jai_reporting_associations jra,
apps.jai_regimes jr
WHERE jith.template_hdr_id = jra.entity_id
AND jra.reporting_usage = 'LR'
--and jra.EFFECTIVE_FROM='01-JAN-2017'
AND jra.effective_to IS NULL
--and jra.REGIME_CODE='GST'
AND jr.regime_id = jra.regime_id
AND jr.regime_code = 'GST' ---Depen on setup
AND jith.organization_id = :inv_org_id
AND jith.inventory_item_id = :inventory_item_id
GROUP BY reporting_code;
AND jith.inventory_item_id = :inventory_item_id
GROUP BY reporting_code;