title: How to call stored procedure in liferay?
body: <p>I am referring <a href="https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/developing-custom-sql-queries" rel="nofollow noreferrer">Using dynamic query in Liferay</a> and using MySQL 5.5 but instead of custom queries involving multiple entities,we need to call a stored procedure.
  We have created a sample procedure</p>
  
  <pre><code>delimiter //
  Create Procedure proc_check (OUT count INT)
  begin
  select count(*) into count from lg_office ;
  end//
  </code></pre>
  
  <p>In default.xml,containing custom queries,we have used</p>
  
  <pre><code>&lt;sql id="de.uhh.l2g.plugins.service.persistence.ProducerFinder.findOfficeCount"&gt;
          &lt;![CDATA[
              Call proc_check(@output)
          ]]&gt;
      &lt;/sql&gt;
  </code></pre>
  
  <p>In the respective Finder method,we used the below snippet to call the stored proc,passing -1 for both begin and end.</p>
  
  <pre><code>String sql = CustomSQLUtil.get(FIND_OFFICE_COUNT);
              SQLQuery q = session.createSQLQuery(sql);
              QueryPos qPos = QueryPos.getInstance(q);
              //qPos.add(lectureseriesId);
              List &lt;Integer&gt; sl =  (List&lt;Integer&gt;) QueryUtil.list(q, getDialect(), begin, end);   
              return sl;
  </code></pre>
  
  <p>In QueryUtil,we could not find other applicable methods to execute the call.
  Post this we get the below error</p>
  
  <pre><code>ERROR [RuntimePageImpl-5][JDBCExceptionReporter:82] ResultSet is from UPDATE. No Data.
  </code></pre>
  
  <p>Is this approach correct with something missing or if not,please suggest approach to achieve the same.</p>