Dynamic SQL

If you want to expand your bind values at run time every time a SQL statement is called, you can use the following feature of Silk Performer. If a program variable starts with two colons, Silk Performer detects dynamic binding and does not call the ODBC function SQLBindParameter for this program variable. The value of the program variable is copied into the SQL statement at run time every time the statement is called.

Examples

The following is an example of Dynamic SQL:

SELECT * FROM article
WHERE a_no >= ::vAno AND a_cat like '::vCat'
for
vAno = 99
vCat = 'trousers'
expands to
SELECT * FROM article
WHERE a_no >= 99 AND a_cat LIKE 'trousers'

The following is an example of Normal Binding:

SELECT * FROM article
WHERE a_no >= :vAno AND a_cat LIKE :vCat
expands to
SELECT * FROM article
WHERE a_no >= ? AND a_cat LIKE ?
plus two additional calls to the ODBC function SQLBindParameter.