title: Call pl/sql function in java?
body: <p>So I've got a function that checks how many cancellations are in my booking table:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION total_cancellations
  RETURN number IS
     t_canc number := 0;
  BEGIN
     SELECT count(*) into t_canc
     FROM booking where status = 'CANCELLED';
     RETURN t_canc;
  END;
  /
  </code></pre>
  
  <p>To execute his in sql I use:</p>
  
  <pre><code>set serveroutput on
  DECLARE
     c number;
  BEGIN
     c := total_cancellations();
     dbms_output.put_line('Total no. of Cancellations: ' || c);
  END;
  /
  </code></pre>
  
  <p>My result is:</p>
  
  <pre><code>anonymous block completed
  Total no. of Cancellations: 1
  </code></pre>
  
  <p>My question is can someone help me call the function in JAVA, I have tried but with no luck.</p>