title: How to call Oracle Function from Java program
body: <p><strong>How to call Oracle Function from Java program...</strong> <br>
  I'm trying to access a function in my db, but i'm not able to do it. I'm doing it in same way as accessing oracle stored procedure. </p>
  
  <pre><code>String packageCallStmt = "{? = call XTRA_TSF_CRE_SQL.XTRA_TSF_CRE(?, ?, ?, ?, ?) }";
      try{
  
          conn = jdbcTemplate.getDataSource().getConnection();
          System.out.println("Inside TransferCreationDAO - Before function call");
          OracleCallableStatement oracleCallableStmt = (OracleCallableStatement) conn.prepareCall(packageCallStmt);
          oracleCallableStmt.setInt(2, src_id);   
          oracleCallableStmt.setInt(3, dest_id);
          oracleCallableStmt.setString(4, refNo);
          oracleCallableStmt.setString(5, item);
          oracleCallableStmt.setInt(6, qty);
          oracleCallableStmt.registerOutParameter(1, OracleTypes.VARCHAR);
          oracleCallableStmt.executeUpdate();
          System.out.println("Inside TransferCreationDAO - After function call");
          tcr.setTsf_No(((OracleCallableStatement) oracleCallableStmt).getString(1));
          System.out.println("Inside TransferCreationDAO - Tsf Number:"+tcr.getTsf_No());
  
      }
  </code></pre>