SELECT qlh.name, qlh.description, qlh.version_no,qll.product_id, product_attr_val_disp,operand, list_line_no
,product_uom_code, start_date_active
FROM qp_list_lines_v qll
,qp_secu_list_headers_v qlh
WHERE qll.list_header_id = qlh.list_header_id
AND qll.product_attribute_context = 'ITEM'
AND EXISTS
(SELECT '1'
FROM MTL_SYSTEM_ITEMS mtl
WHERE product_attr_value = mtl.inventory_item_id
AND mtl.organization_id =
(SELECT qp_util.get_item_validation_org
FROM DUAL)
AND product_attribute = 'PRICING_ATTRIBUTE1'
UNION
SELECT '1'
FROM DUAL
WHERE product_attribute != 'PRICING_ATTRIBUTE1')
AND qll.product_attr_val_disp = NVL(:P_ITEM_CODE, qll.product_attr_val_disp)
---------------Item Code and Description wise
SELECT qsh.name Price_list,
PRODUCT_ID,
PRODUCT_ATTR_VAL_DISP ITEM_CODE,REPLACE(TRIM(msi.DESCRIPTION),Chr(9),'') ITEM_DESCRIPTION,
qsl.PRODUCT_UOM_CODE UOM,
qsl.operand Price,
qsl.start_date_active
FROM qp_secu_list_headers_v qsh, qp_list_lines_v qsl
,mtl_system_items_b msi
WHERE qsh.list_header_id = qsl.list_header_id
AND msi.INVENTORY_ITEM_ID = qsl.PRODUCT_ID
AND qsh.END_DATE_ACTIVE IS NULL
AND qsl.END_DATE_ACTIVE IS NULL
AND msi.organization_id= 122 ---Master Org
-- AND PRODUCT_ATTR_VAL_DISP= 'FGBK0053'
AND INVENTORY_ITEM_STATUS_CODE ='Active'
AND qsh.name <> 'Default price list'
AND qsl.start_date_active > '01-MAY-1951'
Order by 1