Calling a Stored Procedure with null values
Posted in 1998
ASC — — source: Informix-list mailing list archive (1991-1998)
Hello, I want to execute a stored procedure in an Informix Database from a Java application. I use CallableStatement interface and its prepareCall method. Some of the parameters can be null. For example, I prepare the calling: cstmt = con.prepareCall("{call procedure(?,?,?,?)}"); cstmt.setInt(1,null); cstmt.setInt(2,variable1); cstmt.setString(3,variable2); cstmt.setString(4,variable3); With setInt(1,null) I receive an error. I MUST specify a value. Is there a way to pass a null value in this argument ?. It works if I compose a literally string like: prepareCall("{call procedure(null,"+variable1+",'"+variable2+"',"+variable3+"')}"); but I prefer not to use this.