我有一个查询,其中获取一些参数,现在我有一些条目与组织标识和一些条目没有组织标识,但当我运行这个查询时,它不会显示没有组织标识的数据,我只想运行查询,如果数据有组织标识与否。查询在此
SELECT ii.item_desc,
II.ITEM_CODE,
ii.uom,
TO_CHAR (ISL.TRAN_DATE, 'Mon-rr') month,
TO_CHAR (ISL.TRAN_DATE, 'rr-mm') mon,
MONTHS_BETWEEN
(TO_DATE(:edate),
TO_DATE(:sdate) ) Months,
ABS (SUM (isl.qty)) qty
FROM inv_stock_ledger isl, inv_items ii
WHERE isl.item_id = II.ITEM_ID
AND ISL.TRAN_TYPE IN ('SIN', 'SRN', 'STN')
and II.IS_ACTIVE = 'Y'
AND ISL.TRAN_DATE BETWEEN '01-jan-20' AND '31-may-20'
AND isl.item_id = NVL ( :item, isl.item_id)
AND isl.company_id = NVL ( :comp, isl.company_id)
AND isl.branch_id = NVL ( :branch, isl.branch_id)
AND isl.store_id = NVL ( :store, isl.store_id)
AND II.ITEM_CATEGORY_ID = NVL( :VAL_ID, II.ITEM_CATEGORY_ID)
AND isl.ORG_ID = NVL ( :dept, isl.ORG_ID)
GROUP BY ii.item_desc,
II.ITEM_CODE,
ii.uom,
TO_CHAR (ISL.TRAN_DATE, 'Mon-rr'),
TO_CHAR (ISL.TRAN_DATE, 'rr-mm')
ORDER BY TO_CHAR (ISL.TRAN_DATE, 'rr-mm'), II.ITEM_DESC asc
1条答案
按热度按时间bvuwiixz1#
据我所知,是的
isl.org_id
在某些行中有值,并且NULL
在其他方面。如果是这样,你的
注意安全
:dept
参数为null,而不是相反。应该是这样的(假设id的数据类型是number):