I'm new to scriptella and have found it to be very useful thus far but have hit the following roadblock. I have an SQL procedure that already exists within a MYSQL database similar to the following.
DELIMITER //
CREATE PROCEDURE FOO(IN input_param INT, OUT output_param1 INT, OUT output_param2 INT)
BEGIN
/* real FOO sets output_params (conditionally) based on input_param */
/* AND updates an internal table */
SET output_param1 = 1;
SET output_param2 = 2;
END//
DELIMITER ;
I would like to invoke/call this procedure from within Scriptella, similar to the following:
<query connection-id="in">
SELECT SomeColumn FROM SomeTable;
<query connection-id="out1">
CALL FOO(SomeColumn, @OUT1, @OUT2); // ERROR1 exception from this line, see below
<script connection-id="jexl">
etl.globals['OUT1'] = @OUT1; // ERROR2 doesn't like "@"
etl.globals['OUT2'] = @OUT2;
</script>
</query>
<query connection-id="out2">
INSERT INTO AnotherTable (col1, col2)
VALUES (${etl.globals['OUT1']}, ${etl.globals['OUT2']});
</query>
</query>
ERROR1 - Scriptella expects the line "CALL FOO(SomeColumn, @OUT1, @OUT2);" to return a resultSet.
Driver exception: java.sql.SQLException: ResultSet is from UPDATE. No Data.
** If I add "SELECT 1" to the end of the SQL stored procedure, it returns a value and eliminates this error.
ERROR2 - The code above attempts to store the OUT parameter(s) as temporary SQL variables, which don't work in Scriptella.
Driver exception: org.apache.commons.jexl2.JexlException: scriptella.driver.jexl.JexlConnection.run@80 tokenization failed
** It doesn't like the @ symbols or use of temporary variables here.
QUESTIONS Does Scriptella support invoking stored procedures and returning OUT parameters? I've tried a number of workarounds/hacks for this but haven't made any progress to date.
The following script worked for me on mysql: