-1
如何通過日期循環Oracle查詢?我必須把變量放在4個地方。我的查詢從WITH AS開始,所以我不能使用Oracle SQL Loop through Date Range解決方案。循環日期範圍
我也不能創建臨時表。
這裏是我的嘗試:
WITH d
AS (
SELECT DATE'2015-06-22' + LEVEL - 1 AS current_d
FROM dual
CONNECT BY DATE'2015-06-22' + LEVEL - 1 < DATE'2015-10-04'
),
OrderReserve
AS (
SELECT cvwarehouseid
,lproductid
,SUM(lqty) lqty
FROM ABBICS.iOrdPrdQtyDate
GROUP BY cvwarehouseid
,lproductid
)
SELECT
...
WHERE IORDREFILL.DNCONFIRMEDDELDATE < CAST(TO_CHAR(d.current_d , 'YYYYMMDD') AS NUMBER(38))
...
檢查:http://stackoverflow.com/questions/987610/how-to-iterate -over-a-date-range-in-pl-sql –
在此處放置一些示例.. – San
在上述查詢中,Oracle不識別d.current_d – Kulis