# Can't return a result set in the given context:

**URL:** <https://www.ruby-forum.com/t/cant-return-a-result-set-in-the-given-context/171713>\
**Category:** Rails\
**Created:** [July 8, 2009, 2:13am UTC](https://www.ruby-forum.com/t/cant-return-a-result-set-in-the-given-context/171713 "2009-07-08T02:13:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiburcio777](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@tiburcio777](https://www.ruby-forum.com/u/tiburcio777)\
**Post date:** [July 8, 2009, 2:13am UTC](https://www.ruby-forum.com/t/cant-return-a-result-set-in-the-given-context/171713/1 "2009-07-08T02:13:57Z")

</div>

Hello all, I would like to know if there is a way to return a resultset  
from  
a MySQL stored procedure to rails, I’ve tryied many things but I always  
get  
the same error, I found that I need to patch the MySQL connectore, but  
that  
info is from 2006 I am ussing rails 2.3.2, Is there a way do this ? I  
need  
to do a lot of things inside the SP, like creating temporary tables,  
perform  
some calculations, etc.

I would appreciate your help

Thanks…

---

<div class="post-metadata">

**Author:** ![tiburcio777](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@tiburcio777](https://www.ruby-forum.com/u/tiburcio777)\
**Post date:** [July 9, 2009, 4:53pm UTC](https://www.ruby-forum.com/t/cant-return-a-result-set-in-the-given-context/171713/2 "2009-07-09T16:53:50Z")

</div>

After searching the web, I’ve just found that I have to patch the mysql  
adapter, this is not good, I can understad the rails framework  
developers  
being of the opinion that complexity is best located in the code and not  
in  
the database, does not advocate using stored procedures as a abstraction  
layer between the database and the application. But sometimes it is  
really  
neccesary to use stored procedures, What happen if you execute a query  
that  
returns thousand and thousand of records(it will create an object for  
each  
record)? you need to precess them, perform some calculations, I think  
they  
sould think about all the scenarios. Really, they should think about  
this

2009/7/7 Sergio S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![tiburcio777](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@tiburcio777](https://www.ruby-forum.com/u/tiburcio777)\
**Post date:** [July 9, 2009, 9:06pm UTC](https://www.ruby-forum.com/t/cant-return-a-result-set-in-the-given-context/171713/3 "2009-07-09T21:06:25Z")

</div>

Ok, I found a way to get a resultset from a stored procedure, please  
visit  
this page:

> **[MySQL stored procedures with Ruby](https://guyharrison.typepad.com/guy_harrisons_blog/2006/04/mysql_stored_pr.html)**
>
> Ruby's getting an incredible amount of attention recently, largely as the result of Ruby on Rails. I've played a little with Ruby on Rails and it certainly is the easiest way I've seen so far to develop web interfaces to...

Thanks to all

2009/7/9 Sergio S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
