How do I create / retrieve the results of a MySQL stored procedure using Lasso 8.5?

Modified on September 2, 2013.

Instructions on creating and retrieving the results of MySQL 5 stored procedures using Lasso 8.5 and the [ResultSet] tag.

Why

Here’s why you might do this:

  • Your setup involves different programming languages all talking to the same MySQL database and you don’t want to have to re-create the query logic in every programming language.

Creating the MySQL stored procedure

A stored procedure is simply some SQL statements. Almost any valid SQL can go inside a stored procedure.

Create a stored procedure which retrieves all products from the asktami database products table:

    This basically says that I want to:

  1. delete the procedure named "GetAllProducts" if it already exists
  2. create a stored procedure named "GetAllProducts" in a database named asktami.

As you can see, the query that it runs is very simple:

The CREATE command is this:

The DROP command is this:

Calling/running the stored procedure (and retrieving the results)

The command looks like this:

And is used like this:

Alternative methods to display the results using the [ResultSet] tag

An inline which uses a -SQL action can return multiple result sets. Each SQL statement within the -SQL action is separated by a semi-colon and generates its own result set. This allows multiple SQL statements to be issued and for the results of each statement to be reviewed individually.

This is one way to display the results:

The result looks like this:

alternative1

This is another method:

The result looks like this:

alternative1