Prepared Query

A prepared query, also known as a prepared statement or parameterized query, is a SQL statement that is precompiled and stored in a database in a form that allows its efficient execution multiple times with different parameters.

When a prepared query is used, the database server parses, compiles, and optimizes the SQL statement once and creates a prepared execution plan. This prepared execution plan is stored in memory or in the database server's cache, ready to be executed multiple times with different parameter values.


SQL

SQL should be a valid statement. It is possible to add parameters that can be used for passing values from variables. Use curly brackets { } to define input parameters.

Example:

select * from "mySchema"."users" where "id" = {id}

id - an input parameter that can be configured within the properties of the db connector node.

!Important. Ensure to enclose table, column, and schema names in double quotes; otherwise, any uppercase letters will be automatically converted to lowercase. SQL (assume id=1):

select * from mySchema.users where id = {id} 

will trigger an exception because it will be transformed into

select * from myschema.users where id = 1 

and myschema does not exist.

The schema name can be defined within the database URL. In this scenario, it can be omitted.

select * from "users" where "id" = {id}

Will lead to the same result as:

select * from "mySchema"."users" where "id" = {id}

Input Parameters

All detailed information on the Query Input Parameters page.

Last updated