Element "RelDBQueryProcess"

Top  Previous  Next

RelDBQueryProcess element should be placed into a ProcessForm. This element defines the parameters to query the records existing in Relational database tables.

RelDBQueryProcess is a "Container Process" which means it can include sub-processes under it. A Container Process can create a Process Block by processing its own Process Block and pass this created Process Block to its sub-processes.

Defining sub-processes for an RelDBQueryProcess is optional.

You can use the results of a RelDBQueryProcess basically in three ways:

1.To create a ProcessBlock to pass to the sub-processes
2.To create a new Datasource(ADOM)
3.The Both.

RelDBQueryProcess_pe

 

Parameters

Connection Name (Accept MScript)

The name of the JDBC connection defined with RelDBConnection element in the Global Definitions page.

Query (SQL) (Accepts MScript)

In this parameter you should define a SELECT statement to query the Database. The query statement cannot be an update query like INSERT, DELETE or UPDATE.

Example:

 

SELECT * FROM products;

 

selecT MAX(STOCK) AS v:MAX_STOCK from products;

 

Please note that the selecT statement above has a special meaning. See Retrieving Information from database with "selecT".

 

Stored Procedures

In addition to regular select queries you can also make stored procedures calls in this parameter to produce a result set.

Example:

call my_stored_procedure(param1, param2)

 

 

Dynamic Statements

You can use MScript functions to make your SQL statements dynamic. With MScript functions you can refer to the values of the process fields of the ProcessBlock that this process resides in or to other input fields that exist in the ProcessForm and conditionally form your SQL statement.

Example:

 

  @doif(i:fields = '')

    SELECT * FROM products WHERE ID = @vof(ID)

  @doelse()

    SELECT @vof(i:fields) FROM products WHERE ID = @vof(ID)

  @doend() 

 

Process Completion Codes

This Process returns the following completion codes

0 Normal completion
12 An error occurred  (Probably a JDBC error).