title: Calling Database Procedure From Ruby on Rails
body: <p>I'm developing an application using Ruby on Rails and NuoDB and I'm trying to CALL procedures from the database. I'm testing it using the Rails console but I'm only getting a "TRUE" response when I call it using the following command.</p>
  
  <pre><code>ActiveRecord::Base.connection.execute("CALL SHOW_FEEDBACKS_PRC( 'form_name' )")
  </code></pre>
  
  <p>My stored procedure is this:</p>
  
  <pre><code>CREATE PROCEDURE database_name.show_feedbacks_prc (IN P_IN_form string) 
  
       returns tmp_feedbacks (txt1 string, rating integer, comment string, created_at timestamp, updated_at timestamp)
       language sql
       security invoker
  
  as
       insert into tmp_feedbacks 
         select txt1, rating, comment, created_at, updated_at
           from database_name.feedbacks
          where form = p_in_form;
  
  END_PROCEDURE
  </code></pre>
  
  <p>It's a simple query that returns only a list of "feedbacks" which are under a specific "form".</p>
  
  <p>The procedure works when I use NuoDB's console and it returns a table that displays the requested data but when I call it using Rail's console it would only return a "true" response when I execute the SQL command.</p>
  
  <p>Is it possible to get a response as an array of requested data and how do I do this?</p>
  
  <p>I'm trying to execute procedures inside the database instead of making loops inside the rails controllers. </p>