I'm having troubles trying to call a stored procedure from a Spring data repository. Following Spring data documentation and several answers here on SO this seems to be the correct way, but I keep having this error:
PLS-00306: wrong number or types of arguments in call to 'GET_DESCR_BDD_BDS'
This is the stored procedure signature
procedure GET_DESCR_BDD_BDS(PRGPVV in number,
COD_SEZ in number,
FL_BDD_BDS in number,
prg_doc out varchar2,
repo_pos out number
)
And this is how i have implemented the call (I may have messed things up a bit in the different attempts to make things work)
Model
@NamedStoredProcedureQuery(name = "DescrBddBds.descr",
procedureName = "PRK_BDD.GET_DESCR_BDD_BDS",
parameters = {
@StoredProcedureParameter(mode = ParameterMode.IN, name = "PRGPVV", type = Integer.class),
@StoredProcedureParameter(mode = ParameterMode.IN, name = "COD_SEZ", type = Integer.class),
@StoredProcedureParameter(mode = ParameterMode.IN, name = "FL_BDD_BDS", type = Integer.class)
,
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "prg_doc", type = String.class),
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "repo_pos", type = Integer.class)
},
resultClasses = DescrBddBds.class
)
@Entity
public class DescrBddBds implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2182033603838684233L;
@Id
@Column(name = "prg_doc")
private String prgDoc;
@Column(name = "repo_pos")
private Integer repoPos;
public String getPrgDoc() {
return prgDoc;
}
public void setPrgDoc(String prgDoc) {
this.prgDoc = prgDoc;
}
public Integer getRepoPos() {
return repoPos;
}
public void setPepoPos(Integer repoPos) {
this.repoPos = repoPos;
}
}
Repository
@Repository
public interface HtmlProceduresRepo extends CrudRepository<DescrBddBds, String> {
@Procedure(name = "descr", procedureName="PRK_BDD.GET_DESCR_BDD_BDS")
DescrBddBds descr(@Param("PRGPVV") Integer codiceDoc, @Param("COD_SEZ") Integer sezione, @Param("FL_BDD_BDS") Integer flagBddBds);
}
Calling the procedure from SQL Developer with the same user i call it from the application works just fine
var b number;
var d number;
var e number;
exec :b:= 1;
exec :d:= 2;
exec :e:= 3;
execute PRK_BDD.GET_DESCR_BDD_BDS(:b, :d, :e, :out_param1, :out_param2);
print out_param1;
print out_param2;