I am getting an error while using lambda expression(->{ ) for calling a stored procedure.
Error: org.postgresql.util.PSQLException: ERROR: syntax error at or near "{"
Here is the code I am using to call my stored procedure using Prepared Statement.
public void deleteData(Session session, int minVal, int maxVal) throws SQLException {
session.doWork(connection -> {
PreparedStatement st = connection.prepareStatement("{call delete_data(" + minVal + "," + maxVal + ")}");
st.execute();
});
}
I want to execute this stored procedure. Could you please help me with it by suggesting changes or modifying my current code.
Thanks in advance.