# SQL Connector Stored Procedure Can't Return Results

**URL:** <https://forum.bubble.io/t/sql-connector-stored-procedure-cant-return-results/124166>\
**Category:** APIs\
**Created:** [December 4, 2020, 2:17am UTC](https://forum.bubble.io/t/sql-connector-stored-procedure-cant-return-results/124166 "2020-12-04T02:17:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tayloramarotico](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@tayloramarotico](https://forum.bubble.io/u/tayloramarotico)\
**Post date:** [December 4, 2020, 2:17am UTC](https://forum.bubble.io/t/sql-connector-stored-procedure-cant-return-results/124166/1 "2020-12-04T02:17:51Z")

</div>

Hi there,  
I have a stored procedure (MySQL) that takes in one value, and returns a list of items that match the input value. In testing outside of [bubble.io](http://bubble.io), this works perfectly and returns a result set. When I try and move this to bubble, there is no prompt to select the outputs of the stored procedure into variables.

Does anyone have any ideas on how to generate a temporary table/list from the stored procedure output?

Below is the procedure, the test output, and how I added it to [bubble.io](http://bubble.io).  
From first glance, it seems [bubble.io](http://bubble.io)’s only stored procedure functionality is to initiate stored procedures, and cannot read returned data unless it is parameters.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/d/8/d84c52b894e407789640f09dff85a6fc15f32c99.png)  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/5/3/53203407020c7fbeb8f0fd443380305961f21c69.png)  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/c/f/cf455fceae452ca86bbd6f6241ee4eaf9c58d821.png)

Thanks for any input y’all might have!  
Taylor

Edit: I could turn my stored procedure into a plain SELECT statement on [bubble.io](http://bubble.io) directly, but I’m afraid that would greatly affect performance once the result sets hit 100-200 rows.

---

<div class="post-metadata">

**Author:** ![joeyg](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@joeyg](https://forum.bubble.io/u/joeyg)\
**Post date:** [December 4, 2020, 5:33pm UTC](https://forum.bubble.io/t/sql-connector-stored-procedure-cant-return-results/124166/2 "2020-12-04T17:33:20Z")

</div>

I’ve had success using very complex select statements (multi-table joins, unions, grouping, order by, etc.) and the SQL connector performs very well. Give it a try - it shouldn’t take very long to move that sproc to a query on Bubble.

---

<div class="post-metadata">

**Author:** ![tayloramarotico](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@tayloramarotico](https://forum.bubble.io/u/tayloramarotico)\
**Post date:** [December 4, 2020, 7:06pm UTC](https://forum.bubble.io/t/sql-connector-stored-procedure-cant-return-results/124166/3 "2020-12-04T19:06:56Z")

</div>

Thanks for the insight. I have copied the statement over to bubble directly and it seems to work well.

Maybe I’m just being overly cautious or lazy, but I was hoping to call the select functions strictly programmatically. The reason being that each of these statements (some very complicated) will likely need to be used on various parts of our infrastructure (not just my Bubble app) and I would hate to have to update and copy over each statement manually if I ever must make a change…

I’ll stick with your suggestion for now until they improve the functionality. Thank you!

---

<div class="post-metadata">

**Author:** ![joeyg](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@joeyg](https://forum.bubble.io/u/joeyg)\
**Post date:** [December 4, 2020, 7:53pm UTC](https://forum.bubble.io/t/sql-connector-stored-procedure-cant-return-results/124166/4 "2020-12-04T19:53:09Z")

</div>

Gotcha. FWIW, here’s a thread that discusses a workaround solution to get stored procedures to return results to Bubble by tricking it into thinking it’s a select statement:

> [@Sql connector and variables](http://forum.bubble.io/t/sql-connector-and-variables/12910):
>
> I tried to search for an answer to my new question on the forum, but I could not find it. I’m interested in the ability to specify a custom variable that does not match any column. Is it possible to use variables in sql connectore in queries? In sql we use @ for this. How to correctly set the syntax in sql connector? Our query in mysql is working. But sql connector produces an error: an error in the query syntax in the next line of the variable declaration.

I was wary of going down this path so I just went the straight select statement route. In your case where you are duplicating code, it might be worth considering though, so thought I’d point it out.

Joey
