Using Conditions in the SQL Query

Following the WHERE clause, you can specify a search condition for the rows returned by the SELECT statement. The search condition returns a value when a condition evaluates to true about a specific row.

Valid conditions include:

  • Equal
  • Between
  • Like
  • Not In
  • In

Note the following:

  • The parameters returned by the conditions selected in the SQL Query are specified on the Target Application Filters page in Data Management.

  • The = (equal) symbol in a complex query must precede the $ parameters.

  • Target application parameters can have values separated by a comma such as: IN,BETWEEN,NOT IN.

  • The system assigns the data type of the bind parameter. Number and Date are processed As Integer and Date. All other values are treated as Strings.

  • Conditionalized filters are available on the Filters tab of the Run Integration page in Data Integration.

The following table describes the conditions that you can use in the SQL Query.

Condition Description

EQUAL

Check whether two expressions are equal or not. If expressions are equal, then the condition is true and matched records are returned.

When the following SQL statement is run for the equal condition and return records where the customer id equals Smith:

SELECT * FROM Customers

WHERE CustomerID=1

BETWEEN

Checks values between a certain range and returns matched values.

The BETWEEN condition is inclusive. Beginning and ending values are included.

BETWEEN syntax:

SELECT column_name(s)

FROM table_name

WHERE column_name BETWEEN value1 AND value2;

LIKE

Performs and returns pattern matching using wildcards in the WHERE clause of a SELECT statement.

Two wildcards are used in conjunction with the LIKE operator:

  • %: The percent sign represents zero, one, or multiple characters

  • _ : The underscore represents a single character

LIKE syntax:

SELECT column1, column2, ...

FROM table_name

WHERE column LIKE pattern

IN

Equal to any value in a list of values.

IN syntax:

SELECT column_name1, column_name2, etc

FROM table_name

WHERE column_name1 IN (value1, value2, etc);

NOT IN

Check whether two expressions equal or not. If expressions are not equal, then condition is true and returns not matched records.

NOT IN syntax:

SELECT column_name1, column_name2, etc

FROM table_name

WHERE column_name1 NOT IN (value1, value2, etc);