我正在尝试使用 PL/SQL 中的以下代码将字符串转换为日期:
BEGIN
vfrom := TO_DATE ('20/08/2013', 'dd/mm/yyyy');
vto := TO_DATE ('30/08/2013', 'dd/mm/yyyy');
OPEN L_CURSOR FOR
SELECT DSAT.ORGANIZATION_ID,
APPS.DAW_INV_ORG_NAME (DSAT.ORGANIZATION_ID) ORGANIZATION_NAME,
APPS.DAW_CAT_NAME (MC.SEGMENT4) PRODUCT,
TRUNC (NVL (DSAT.SCH_END_DATE, DSAT.SCH_START_DATE))
TRANSACTION_DATE,
TO_CHAR (NVL (DSAT.SCH_END_DATE, DSAT.SCH_START_DATE),
'MM-YYYY')
MONTH,
DSAT.ITEM_SEGMENTS ITEM_CODE,
DSAT.ITEM_DESCRIPTION,
DSAT.CURRENT_FORECAST_QUANTITY PLAN_QTY
FROM APPS.DAW_SCPDB_ASCP_TPP_V DSAT,
APPS.MTL_ITEM_CATEGORIES MIC,
APPS.MTL_CATEGORIES MC
WHERE NVL (SCH_END_DATE, SCH_START_DATE) BETWEEN '$(vfrom)'
AND '$(vto)'
AND MIC.CATEGORY_SET_ID = 1100000061 --- PLANING CATEGORY
AND MC.CATEGORY_ID = MIC.CATEGORY_ID
AND DSAT.INVENTORY_ITEM_ID = MIC.INVENTORY_ITEM_ID
AND DSAT.ORGANIZATION_ID = MIC.ORGANIZATION_ID
AND DSAT.FORECAST_SET = '$(vForecastSetDPL2)'; --- Need to Update it on Monthly Basis;
END PorductPlanningForecast;
错误发生为
ORA-01858: 在第 29 行预期为数字的地方发现了一个非数字字符
其中包括打开游标进行查询。我已经检查了 NSL 参数并在 to_Date 函数中将日期设置为此处的格式,在互联网上进行了搜索,但我无法弄清楚。请帮忙。