FROM apps.ap_suppliers aps ,
apps.ap_invoices_all ai ,
apps.ap_invoice_lines_all ail ,
apps.ap_invoice_distributions_all aid,
apps.AP_DISTRIBUTION_SETS_all ads ,
apps.gl_code_combinations_kfv gcc ,
apps.ap_checks_all aca ,
apps.ap_invoice_payments_all aipa ,
apps.FND_TERRITORIES_TL ft
WHERE aps.vendor_id = ai.vendor_id
AND ai.invoice_id = ail.invoice_id
AND ai.invoice_id = aid.invoice_id
AND ail.invoice_id = aid.invoice_id
AND ai.DISTRIBUTION_SET_ID = ads.DISTRIBUTION_SET_ID(+)
AND aid.dist_code_combination_id = gcc.code_combination_id
AND aca.check_id = aipa.check_id
AND aipa.invoice_id = ai.invoice_id
AND aca.vendor_id = aps.vendor_id
AND aca.vendor_id = ai.vendor_id
AND aca.COUNTRY = ft.TERRITORY_CODE
AND ai.invoice_id =nvl(p_invoice_id,ai.invoice_id)
AND ai.last_update_date BETWEEN NVL(p_from_date,ai.last_update_date)
AND NVL(p_to_date,sysdate+1);
last_update_date的日期类似于11-JUN-16, 所以我也是如此。 查询在日期参数级别失败(数据类型为p_from_date Date,p_to_date Date)。查询返回无结果
答案 0 :(得分:0)
last_update_date是一个日期。数据不是11-JUN-16,它是作为日期保存的。传入类似'11 -JUN-16'的字符串时,可能会被解释为11/06/0016。您将不会有任何旧的发票,这可能是您的查询不返回任何数据的原因。
将字符串转换为日期时,始终说明格式。为什么不总是使用四位数年份来避免歧义。最后使用数字月 - 这种语言不是问题:
TO_DATE('11/06/2016','DD/MM/YYYY')