Execute immediate into not working

Hi
I am getting compilation error while running execute immediate into a variable.

Code works fine without “into” option but i need the output of the query in a variable to use it further in stored procedure.

DB Version: 7.0.20

syntax: execute immediate v_sql into v_out;

1 Like

Did you declare the variable?

This works fine in 7.8:

singlestore> delimiter //
singlestore> do
    -> declare x int;
    -> declare v_sql text = "select 100";
    -> begin
    ->   execute immediate v_sql into x;
    ->   echo select x;
    -> end 
    -> //
+------+
| x    |
+------+
|  100 |
+------+

I’m not sure if there’s a bug in 7.0.20 for this, but 7.0 is out of support, so we would not make any fixes to it.

1 Like