title: How do I use an IN OUT CLOB parameter defined in a Stored Proc in Oracle JDBC?
body: <p>I have the following stored procedure defined: </p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE NOTIFY_INSERT (
    FLAG IN VARCHAR2,
    MESSAGE IN OUT CLOB,
    SEQ_NO OUT NUMBER
  ) 
  AS
  BEGIN
  ...
  END;
  </code></pre>
  
  <p>Now I'm trying to call this stored proc in JDBC. However, I get an exception saying "java.sql.SQLException: Parameter Type Conflict". This is raised from the line </p>
  
  <pre><code>call.execute();
  </code></pre>
  
  <p>I'm guessing it has something to do with the second parameter, which is a CLOB.</p>
  
  <p><strong>Does anyone have an idea what I'm doing wrong?</strong></p>
  
  <p>Thanks for your help.</p>
  
  <pre><code>Connection connection = dataSource.getConnection();
  CallableStatement call = null;
  try {
      call = connection.prepareCall("{ call NOTIFY_INSERT (?,?,?) }");
      call.setString(1, flag);
      call.registerOutParameter(2, Types.CLOB);
      call.setString(2, message);
      call.registerOutParameter(3, Types.NUMERIC);
      call.execute();
      sequenceNo = call.getLong(3);
      message = call.getString(2);
  } catch (SQLException e) {
      e.printStackTrace();
  } finally {
      if (call != null) {
          try { call.close(); } catch (SQLException sqle) {}
      }
  }
  </code></pre>
  
  <p>JDBC Exception:</p>
  
  <pre><code>java.sql.SQLException: Parameter Type Conflict
      at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2480)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4356)
      at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:4595)
      at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:10100)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:5693)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
  </code></pre>