Hibernate: how to call a stored function returning a varchar?

前端 未结 4 1539
隐瞒了意图╮
隐瞒了意图╮ 2021-01-13 01:45

I am trying to call a legacy stored function in an Oracle9i DB from Java using Hibernate. The function is declared like this:

create or replace FUNCTION Tran         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 02:21

    For further reference, here is my final solution:

    CallableStatement statement = session.connection().prepareCall(
            "{ ? = call Transferlocation_Fix(?) }");
    statement.registerOutParameter(1, Types.VARCHAR);
    statement.setString(2, "FC3");
    statement.execute();
    String result = statement.getString(1);
    

提交回复
热议问题