title: Call Oracle object-oriented PL/SQL member procedures from JDBC
body: <p>In object-oriented PL/SQL, I can add member procedures and functions to types. An example is given here:</p>
  
  <pre><code>create type foo_type as object (
    foo number,
  
    member procedure proc(p in number),
    member function  func(p in number) return number
  );
  
  create type body foo_type as 
    member procedure proc(p in number) is begin
      foo := p*2;
    end proc;
  
    member function func(p in number) return number is begin
      return foo/p;
    end func;
  end;
  </code></pre>
  
  <p>From: <a href="http://www.adp-gmbh.ch/ora/plsql/oo/member.html" rel="noreferrer">http://www.adp-gmbh.ch/ora/plsql/oo/member.html</a></p>
  
  <p>In PL/SQL, I can then call these member procedures/functions like this:</p>
  
  <pre><code>declare
      x foo_type;
  begin
      x := foo_type(5);
      x.proc(10);
      dbms_output.put_line(x.func(2));
  end;
  </code></pre>
  
  <p>How can I do it with JDBC's CallableStatement? I can't seem to find this in the documentation easily.</p>
  
  <p><strong>NOTE</strong>: This is one possibility, inlining the type constructor:</p>
  
  <pre><code>CallableStatement call = c.prepareCall(
      " { ? = call foo_type(5).func(2) } ");
  </code></pre>
  
  <p>But what I'm looking for is something like this (using <code>java.sql.SQLData</code> as a parameter):</p>
  
  <pre><code>CallableStatement call = c.prepareCall(
      " { ? = call ?.func(2) } ");
  </code></pre>
  
  <p>Also, member functions, procedures may modify the object. How can I get the modified object back in Java?</p>