posted 2 years ago
A. The stored procedure can declare an IN or INOUT parameter.
B. The stored procedure can declare an INOUT or OUT parameter.
C. The stored procedure must declare an IN parameter.
D. The stored procedure must declare an INOUT parameter.
E. The stored procedure must declare an OUT parameter.
Since the code calls registerOutParameter(), we know the stored procedure cannot use an IN parameter. Further, there is no setInt(), so it cannot be an INOUT parameter either. Therefore, the stored procedure must use an OUT parameter, making option E the answer.
----
My question is: the sql is {call transform(?)}, which has an input parameter. The provided code doesn't set a value for the input parameter. What happens at runtime if stored procedure declare OUT parameter?
I think, the correct answer must be: "The stored procedure must declare an INOUT parameter and cs.setString(1, "a value") must be added before cs.execute() statement".
Or maybe the question must be corrected with var sql = "{call transform()}";