gpt4 book ai didi

java - 如何在不返回结果集的spring boot中执行存储过程?

转载 作者:行者123 更新时间:2023-11-29 07:31:33 25 4
gpt4 key购买 nike

我想执行不返回任何数据集的存储过程。我已经使用这个存储过程来更新记录..我的代码是

 Query q1 = entityManager.createNativeQuery("call rrear_etl_processing.Sp_UpdateOATSROE( ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31, ?32, ?33, ?34, ?35, ?36, ?37, ?38, ?39, ?40, ?41, ?42, ?43, ?44, ?45, ?46, ?47, ?48, ?49, ?50, ?51, ?52, ?53, ?54, ?55, ?56, ?57, ?58, ?59, ?60, ?61, ?62, ?63, ?64, ?65, ?66, ?67, ?68, ?69, ?70, ?71, ?72, ?73, ?74, ?75, ?76, ?77, ?78, ?79, ?80, ?81, ?82, ?83, ?84, ?85, ?86, ?87, ?88, ?89, ?90, ?91, ?92, ?93, ?94, ?95, ?96, ?97, ?98, ?99, ?100, ?101, ?102, ?103, ?104, ?105, ?106, ?107, ?108, ?109, ?110, ?111, ?112, ?113 ,?114, ?115, ?116, ?117)")
.setParameter(1,P_RowID)
.setParameter(2,P_Exception_CD)
.setParameter(3,P_Exception_Description)
.setParameter(4,P_ORDER_EVENT_TYPE)
.setParameter(5,P_OrderDatetime)
**remaining parameters
List result = q1.getResultList();

最佳答案

已解决我使用 .executeUpdate(); 不返回任何结果集。希望对大家有帮助

    Object q1 = entityManager.createNativeQuery("call rrear_etl_processing.Sp_UpdateOATSROE( ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31, ?32, ?33, ?34, ?35, ?36, ?37, ?38, ?39, ?40, ?41, ?42, ?43, ?44, ?45, ?46, ?47, ?48, ?49, ?50, ?51, ?52, ?53, ?54, ?55, ?56, ?57, ?58, ?59, ?60, ?61, ?62, ?63, ?64, ?65, ?66, ?67, ?68, ?69, ?70, ?71, ?72, ?73, ?74, ?75, ?76, ?77, ?78, ?79, ?80, ?81, ?82, ?83, ?84, ?85, ?86, ?87, ?88, ?89, ?90, ?91, ?92, ?93, ?94, ?95, ?96, ?97, ?98, ?99, ?100, ?101, ?102, ?103, ?104, ?105, ?106, ?107, ?108, ?109, ?110, ?111, ?112, ?113 ,?114, ?115, ?116, ?117)")
.setParameter(1,P_RowID)
.setParameter(2,P_Exception_CD)
.setParameter(3,P_Exception_Description)
.setParameter(4,P_ORDER_EVENT_TYPE)
.setParameter(5,P_OrderDatetime)
*
*
.setParameter(115,P_MPID_OATS_Exc_ID )
.setParameter(116,P_Report_Header_ID)
.setParameter(117,P_Updated_By)
.executeUpdate();

关于java - 如何在不返回结果集的spring boot中执行存储过程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51024908/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com