Skip to content

An introduction to OMrun – 2 – Working with parameters

In the last post we compared the list of databases in the same PostgreSQL cluster using OMrun. The setup for this was pretty simple: We’ve defined the environment using the PostgreSQL Data Adapter and created the connections to two databases. In a new “Test Data Object” we’ve written the SQL statement to list all databases and once the test was executed OMrun compared the results.

This is how it looked like at the end of the previous post:

The select statement we used did not use a where clause, it just lists all the databases. If we want to restrict the result, we can do it like this:

Very simple SQL (of course an in-list with just one value does not make much sense). A potential issue with this is, that we hard code the value(s) into the statement. This is where the parameters come into the game. In OMrun you can define up to four parameters which will get passed into the statement. You can already see that in the lower right section in the screenshot above. Instead of hard coding the value(s), we can define a parameter and pass the parameter into the statement by referencing it with “@param1”:

Our statement has become more dynamic. Passing multiple values by using one parameter is possible as well:

Questions about your own setup? A dbi services consultant can look at your case.

Talk to an expert (opens in a new tab)

In the same way the remaining parameters can be used, e.g. like this:

Doing it like this, will result in the test to fail, of course. You can even go a step further and use nested parameters:

As you can see, this gives you great flexibility with passing values into your statements.

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Open source Team

Open source Team

Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.View Author posts

721 posts since September 2011

Most read in PostgreSQL

The PostgreSQL posts our readers open most: the all-time favourites, and what is trending right now.

Leave a Comment

Your email address will not be published. Required fields are marked *