I have a following PL/SQL procedure:
CREATE OR REPLACE PROCEDURE getDogInfo
(Dog_ID IN NUMBER, Dog_name OUT VARCHAR) AS
BEGIN
  SELECT Dog_name INTO Name
  FROM Dog_family
  WHERE ID = Dog_ID;
END;
I need to make a java class file that does the same. I've been trying like this:
import java.sql.*;
import java.io.*;
public class Procedure {
  public static void getDogInfo (int Dog_ID, String Dog_name)
    throws SQLException
    { String sql =
      "SELECT Dog_name INTO Name FROM Dog_family WHERE ID = Dog_ID";
    try { Connection conn = DriverManager.getConnection("jdbc:default:connection:");
      PreparedStatement apstmt = conn.prepareStatement(sql);
      apstmt.setInt(1, Dog_ID);
      apstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
      ResultSet rset = apstmt.executeQuery();
      rset.close();
      apstmt.close(); //Connection close
      }
    catch (SQLException e) {System.err.println(e.getMessage());
    }
  }
}
What am I doing wrong? Can someone help me get this working? Thanks
 
     
     
     
     
    