Using SBN expressions in queries

The following examples show how to use SBN expressions in queries.

Examples

A SELECT statement to retrieve a specific customer record might include a constant customer record CU_NO for that record.

SELECT * FROM CUSTOMERS WHERE CU_NO = '12345678'

With SBN you can use a more flexible approach by assigning the constant value of CU_NO to a component variable. Assuming that value ‘12345678’ was assigned to CustNo, the SELECT statement with the dynamic expression would look like the following example:

SELECT * FROM CUSTOMERS WHERE CU_NO = '[REF.CustNo]'

You can use any of the Sybase IQ ETL functions inside the SBN. The following statement returns the same record using a value of “1234” for CustNo1 and a value of “4567” for CustNo2:

SELECT * FROM CUSTOMERS WHERE CU_NO = '[uConcat (REF.CustNo1, REFCustNo2)'

Manipulating the TRACE level at the start of a query

To manipulate the TRACE level at the start of a query, SELECT * FROM PRODUCT [uTracelevel(5)].

The function uTracelevel() returns no value; therefore, the SBN expression [uTracelevel(5)] can coexist with the SQL statement. After the SBN expression has been evaluated, the SQL statement to execute will be:

SELECT * FROM PRODUCT

You can even execute the following query:

[uTracelevel(0)]