我正在尝试将我的数据库从oracle迁移到mariadb。
当我删除select查询时,它执行得很好,否则程序显示错误。
SELECT MSFID, CONVEFEES INTO OUT_MSFID,OUT_CONVEFEES
FROM
(SELECT MSF.MSFID
(CASE WHEN MSF.CHARGETYPE = 'H' THEN
(CASE WHEN (LV_METRNAMT*((IFNULL(FIXPER,0))/100)) > (IFNULL(FIXAMT,0)) THEN
(LV_METRNAMT*((IFNULL(FIXPER,0))/100))
ELSE (IFNULL(FIXAMT,0) )END)
WHEN MSF.CHARGETYPE = 'L' THEN
(CASE WHEN (LV_METRNAMT*((IFNULL(FIXPER,0))/100)) > (IFNULL(FIXAMT,0)) THEN
(IFNULL(FIXAMT,0))
ELSE (LV_METRNAMT*((IFNULL(FIXPER,0))/100))
END)
ELSE
(LV_METRNAMT*((IFNULL(FIXPER,0))/100)) + (IFNULL(FIXAMT,0))
END)
-- (P_METRNAMT*((IFNULL(DMPER_OFFUS,0)*100)/100))+ (IFNULL(DMFIXAMT_OFFUS,0) * 100)
AS CONVEFEES
FROM VTMEMSF MSF
WHERE CURRENT_DATE() BETWEEN MSF.EFFFROM AND MSF.EFFTILL AND MSF.SLABUPTO>= LV_METRNAMT AND STOREID=P_STOREID
AND `MSF.STATUS` = 'A' AND MSF.MSFTYPE='C' -- AND MSF.TRANTYPE=P_TRNTYPE
ORDER BY SLABUPTO)
LIMIT 1;
答案 0 :(得分:0)
SELECT MSFID, CONVEFEES INTO OUT_MSFID,OUT_CONVEFEES
FROM
(SELECT MSF.MSFID
(CASE WHEN MSF.CHARGETYPE = 'H' THEN
(CASE WHEN (LV_METRNAMT*((IFNULL(FIXPER,0))/100)) > (IFNULL(FIXAMT,0)) THEN
(LV_METRNAMT*((IFNULL(FIXPER,0))/100))
ELSE (IFNULL(FIXAMT,0) )END)
WHEN MSF.CHARGETYPE = 'L' THEN
(CASE WHEN (LV_METRNAMT*((IFNULL(FIXPER,0))/100)) > (IFNULL(FIXAMT,0)) THEN
(IFNULL(FIXAMT,0))
ELSE (LV_METRNAMT*((IFNULL(FIXPER,0))/100))
END)
ELSE
(LV_METRNAMT*((IFNULL(FIXPER,0))/100)) + (IFNULL(FIXAMT,0))
END)
#-- (P_METRNAMT*((IFNULL(DMPER_OFFUS,0)*100)/100))+ (IFNULL(DMFIXAMT_OFFUS,0) * 100)
AS CONVEFEES
FROM VTMEMSF MSF
WHERE CURRENT_DATE() BETWEEN MSF.EFFFROM AND MSF.EFFTILL AND MSF.SLABUPTO>= LV_METRNAMT AND STOREID=P_STOREID
AND `MSF.STATUS` = 'A' AND MSF.MSFTYPE='C' #-- AND MSF.TRANTYPE=P_TRNTYPE
ORDER BY SLABUPTO) s
LIMIT 1;