当我尝试将变量传递给此过程时:
PROCEDURE REMOVAL_ATR_PR340_FR73_S1_T1(
p_POE_STEAM_TURBINES_VID NUMBER,
p_PERIOD_ID NUMBER,
p_STOP_ID in out number,
p_REMOVAL_LAST_YEAR in out NUMBER
)
IS
BEGIN
SELECT pr.STOP_ID,
pr.REMOVAL_LAST_YEAR
INTO p_STOP_ID,
p_REMOVAL_LAST_YEAR
FROM FORMS fr
LEFT JOIN PR340_FR73_S1_T1 pr
ON pr.FORMS_ID = fr.ID
WHERE PERIOD_ID = p_PERIOD_ID - 1
AND pr.POE_STEAM_TURBINES_VID = p_POE_STEAM_TURBINES_VID;
END REMOVAL_ATR_PR340_FR73_S1_T1;
此错误出现:
play.api.Application$$anon$1: Execution exception[[PersistenceException: java.sql.SQLException: Invalid column index
此代码调用过程:
String sql = "{call REA.FILL_EVENT.REMOVAL_ATR_PR340_FR73_S1_T1(" + doc.poeSteamTurbine.vid + "," + doc.form.periodId +"," + 0 + "," + 0 +") } ";
CallableSql cs = Ebean.createCallableSql(sql);
cs.registerOut(3, Types.INTEGER);
cs.registerOut(4, Types.INTEGER);
Ebean.execute(cs);
Integer retValue = (Integer) cs.getObject(3);
我做错了什么?
答案 0 :(得分:0)
使用绑定变量:
String sql = "{call REA.FILL_EVENT.REMOVAL_ATR_PR340_FR73_S1_T1(?,?,?,?) } ";
CallableSql cs = Ebean.createCallableSql(sql);
cs.setParameter(1,doc.poeSteamTurbine.vid);
cs.setParameter(2,doc.form.periodId);
cs.setParameter(3,0);
cs.registerOut(3, Types.INTEGER);
cs.setParameter(4,0);
cs.registerOut(4, Types.INTEGER);
Ebean.execute(cs);
Integer retValue = (Integer) cs.getObject(3);
答案 1 :(得分:0)
工作:
String sql = "{call REA.FILL_EVENT.REMOVAL_ATR_PR340_FR73_S1_T1(?,?,?,?) } ";
CallableSql cs = Ebean.createCallableSql(sql);
cs.setParameter(1,doc.poeSteamTurbine.vid);
cs.setParameter(2,doc.form.periodId);
cs.registerOut(3, Types.INTEGER);
cs.registerOut(4, Types.INTEGER);
Ebean.execute(cs);
doc.prevStopId = (Integer) cs.getObject(3);
doc.prevRemovalLastYear = (Integer) cs.getObject(4);
return doc;