IN, OUT, or INOUT not valid for parameter in procedure

newBee picture newBee · Jun 6, 2014 · Viewed 10k times · Source

I'm calling a RPG procedure from my java , and I'm getting the an error.

ERROR o.h.e.jdbc.spi.SqlExceptionHelper - [SQL0469] IN, OUT, or INOUT not valid for parameter 4 in procedure  in *N.

One of the parameters in query is both IN and OUT.

I just tried to write a small query as below

 "CALL " + procedureName + "(2014, 1, 1.00, 0,'Y' )");

Here parameter number 4 (0) is the output the query returns also as an input.

Any help?

This is the actual query I wrote

   rpgCall = connection.prepareCall("CALL " + procName + "(?, ?, ?, ?, ?)");

            rpgCall .setInt(1, params.year);
            rpgCall .setInt(2, params.value1);
            rpgCall .setInt(3, params.value2);
            rpgCall .setInt(4,params.value3); 
            rpgCall .setString(5, "Y");
            rpgCall .execute();

Answer

Scott Mildenberger picture Scott Mildenberger · Jun 6, 2014

If the parameter is OUT then you need to have a variable in that position - you can't pass it a constant because the procedure cannot change that.