1

Anyone know how to make a "fully-qualified name of an SQL structured type " tobe passed as an argument to this function:

public void registerOutParameter(int paramIndex,
                                 int sqlType,
                                 String typeName)
                          throws SQLException

Parameters:

  • paramIndex - the first parameter is 1, the second is 2,...
  • sqlType - a value from Types
  • typeName - the fully-qualified name of an SQL structured type
ruakh
  • 175,680
  • 26
  • 273
  • 307

1 Answers1

0

Java Object class has a getClass() method, it will return the Class of that object and toString() will give you the fully qualified class name.

String classname = myobj.getClass().toString()

while calling registerOutParameter() pass arguments like this,

public void registerOutParameter(1,2,myobj.getClass().toString())
Rajesh Pantula
  • 10,061
  • 9
  • 43
  • 52
  • String call="{call es_job.create_user_job(?,?)}"; CallableStatement Sstmt=(CallableStatement)conn.prepareCall( call); // set the in param going into stored procedure only Sstmt.setString(1, "some text"); // set the in param coming out of stored procedure only Sstmt.registerOutParameter(3, java.sql.Types.CHAR, Sstmt.getClass().toString()); Sstmt.execute(); //rsJob = Sstmt.getString("jobid"); //System.out.println(rsJob + " " + rsJob.length()); Sstmt.close(); – user1135204 Jan 07 '12 at 14:44
  • I have an oracle stored procedure that returns a char(5). I like to call this from java. Which one of the registerOutParameter functions of the CallableStatement can be used to get this char(5)? – user1135204 Jan 07 '12 at 14:51