我已經從一組表中提取數據,這些表需要有一個where子句和數據作爲列。 我的團隊在每次運行查詢時手動輸入日期都出錯。我想編寫一個PL SQL來從數據庫(oracle)動態獲取日期字段。 以下是查詢。需要PL/SQL腳本想法
select oli.cart_key,lext.minor_order_number,wlkp.mf_wh_loc_id,oli.warehouse_type from tab1 oli,tab2 lext,tab3 wlkp where
oli.cart_line_key = lext.cart_line_key and
oli.warehouse_code = wlkp.warehouse_code and
oli.warehouse_type = 'DC' and
lext.fulfillment_partner_key = 106 and
lext.order_status_secondary = 2000 and
lext.date_sent_to_fp is not null and
to_char(lext.date_sent_to_fp ,'DD-MON-YYYY HH24:MI:SS') >= ('01-APR-2014 03:00:00') and
oli.active_flag = 'Y' and wlkp.active_flag = 'Y'
order by wlkp.mf_wh_loc_id
日期字段'01 -APR-2014 03:00:00'是我想從雙重表中獲得的東西。是否有可能這樣做?
請讓我知道。
問候, 阿倫
您需要在此澄清。你說你想要一個參數,那麼你說它應該來自雙重表格。雙表沒有日期字段,所以你可能想要前者?或者你想使用一個帶有日期字段的參數表? –
謝謝弗蘭克的建議。我想在凌晨3點的日期和時間來自系統/數據庫是dd-MON-YYYY 03:00:00。由於查詢在每天凌晨3點手動運行 – user3168807