I have an oracle Stored Procedure which i can't change or code. The Procedure receives the following I/O
CREATE OR REPLACE PROCEDURE "SCHEMA"."NAMEPROCEDURE"
(
ZCLIENTE_IN IN CHAR,
CKBALCAO_IN IN CHAR,
NRPROCES_IN IN NUMBER,
DTINICIO_IN IN CHAR,
DTFIM_IN IN CHAR,
TPDOCUME_IN IN CHAR,
EMAIL_IN IN CHAR,
OK_KO_OUT OUT CHAR,
MSGERR_OUT OUT VARCHAR2
)
IS
PROXNUM CHAR(14);
BEGIN ...
...
This procedure inserts my Input in some tables. In a springBoot application i am trying to call it with the following repository code:
String procedureName = "NAMEPROCEDURE";
String catalogName = "SCHEMA";
String okKo ="";
String msgErro ="";
simpleJdbcCall.withCatalogName(catalogName).withProcedureName(procedureName)
.declareParameters(new SqlOutParameter("OK_KO_OUT", OracleTypes.CHAR), new SqlOutParameter("MSGERR", OracleTypes.VARCHAR),
new SqlInOutParameter("ZCLIENTE_IN", OracleTypes.CHAR),
new SqlInOutParameter("CKBALCAO_IN", OracleTypes.CHAR),
new SqlInOutParameter("NRPROCES_IN", OracleTypes.NUMBER),
new SqlInOutParameter("DTINICIO_IN", OracleTypes.CHAR),
new SqlInOutParameter("DTFIM_IN", OracleTypes.CHAR),
new SqlInOutParameter("TPDOCUME_IN", OracleTypes.CHAR),
new SqlInOutParameter("EMAIL_IN", OracleTypes.CHAR)
);
MapSqlParameterSource inParams = new MapSqlParameterSource();
inParams.addValue("ZCLIENTE_IN", "1111111111", OracleTypes.CHAR);
inParams.addValue("CKBALCAO_IN", "0000", OracleTypes.CHAR);
inParams.addValue("NRPROCES_IN", 20160000001L, OracleTypes.BIGINT);
inParams.addValue("DTINICIO_IN", "2016-01-01", OracleTypes.CHAR);
inParams.addValue("DTFIM_IN", "2019-01-01", OracleTypes.CHAR);
inParams.addValue("TPDOCUME_IN", "0011", OracleTypes.CHAR);
inParams.addValue("EMAIL_IN", "someEmail@gmail.com", OracleTypes.CHAR);
Map<String, Object> simpleJdbcCallResult = simpleJdbcCall.execute(inParams);
But i am receiving the follwoing log error:
org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar [{call SCHEMA.NAMEPROCEDURE()}]; nested exception is java.sql.SQLException: ORA-06550: linha 1, coluna 7: PLS-00306: número errado ou tipos de argumentos na chamada para 'PROCEDURENAME' ORA-06550: linha 1, coluna 7:~
Caused by: java.sql.SQLException: ORA-06550: linha 1, coluna 7: PLS-00306: número errado ou tipos de argumentos na chamada para 'PROCEDURENAME' ORA-06550: linha 1, coluna 7: PL/SQL: Statement ignored
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0] at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0] at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0] at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0] at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587) ~[ojdbc7-12.1.0.2.jar:12.1.0.2.0]
I have no idea of what am i doing wrong, because if i have the same call with just 2 arguments and returning a Cursor it works perfectly.
Tks in Advance
Found the answer for anyone who's having the same problem. In my Pom.xml I had ojdbc7 driver and need to have ojbdc6. Heres de dependency:
No idea why but it worked for me. There must be some incompatibility between SQL- call function and oracle.