从CRS_T_RES_VOUCHER
获取IS_OFFLINE_BOOKING
为真的所有优惠券和(系统日期 - CRS_T_RES_REGISTRATION。UPDATED_DATE
)>离线取消阈值
离线取消阈值可以从CRS_T_HTL_PARAMETER
表中获取。
PARAM_KEY - IBE_OFFLINE_CANCELLATION_THRESHOLD
SELECT v.VOUCHER_NUMBER
FROM CRS_T_RES_VOUCHER v,
CRS_T_RES_REGISTRATION regi,
CRS_T_HTL_PARAMETER para
WHERE v.is_offline_booking = '1'
AND TRUNC (SYSDATE) - TRUNC (v.updated_date) > para.param_value WHERE para.param_key = 'IBE_OFFLINE_CANCELLATION_THRESHOLD'
我遇到ORA-00933:SQL命令未正确结束
答案 0 :(得分:0)
您收到错误的原因是您有两次写入where子句两次。变化:
where para.param_key = 'IBE_OFFLINE_CANCELLATION_THRESHOLD'
致:
and para.param_key = 'IBE_OFFLINE_CANCELLATION_THRESHOLD'
根据你的上一条评论,试试这个:
SELECT v.VOUCHER_NUMBER
FROM CRS_T_RES_VOUCHER v,
CRS_T_RES_REGISTRATION regi,
CRS_T_HTL_PARAMETER para
WHERE v.is_offline_booking = '1'
AND TRUNC (SYSDATE) - TRUNC (v.updated_date) >
(select distinct TRUNC(para.param_value) from CRS_T_HTL_PARAMETER
WHERE para.param_key = 'IBE_OFFLINE_CANCELLATION_THRESHOLD')
请注意,上述查询仅在没有多个param_values用于' IBE_OFFLINE_CANCELLATION_THRESHOLD' param key。
答案 1 :(得分:0)
我明白了 需要处理嵌套查询
SELECT v.VOUCHER_NUMBER
from CRS_T_RES_VOUCHER v, CRS_T_RES_REGISTRATION regi, CRS_T_HTL_PARAMETER para
where v.is_offline_booking = '1' and
TRUNC (SYSDATE) - TRUNC (v.updated_date) > (select TRUNC (para.param_value)
from CRS_T_HTL_PARAMETER para where para.param_key = 'IBE_OFFLINE_CANCELLATION_THRESHOLD')