Syntax2 - using dynamic adapter commands
Use Syntax2 to execute a SELECT statement that retrieves a specific column value from a table or database when the database, table, or other database parameters may vary. This can be used when parameters are being supplied by a parameter file.
DBLOOKUP(
SQL_statement,adapter_commands
)
DBQUERY(
SQL_statement,adapter_commands
)
Using this syntax and the Syntax 2 formatting issues (Syntax2 formatting issues ), DBLOOKUP and DBQUERY use the following arguments.
- Argument
- Explanation
- SQL_statement
- single_text_expression
- adapter_commands
-
Either -MDQ mdq_file -DBNAME db_nameor -DBTYPE database_type [database_adapter_commands]
The following table describes these arguments in more detail.
- Argument
- Description
- SQL_statement
- SQL statement as a text string. It can be any valid SQL
statement permitted by your database management system and supported by your
database-specific driver.
In addition to a fixed SQL statement, this argument can be a concatenation of text literals and data objects, enabling the concatenation of data values into your SQL statement.
- adapter_commands
- Either the - MDQ or the - DBTYPE adapter command can be used for this argument.
- -MDQ
- This adapter command is followed by the name of the MDQ file
produced by the Database Interface Designer. This MDQ
file contains the definition of the database against which the SQL statement is to
be executed. If the MDQ file is in a directory other than the directory of the
map, the path must be specified.
The MDQ file name is followed by the -DBNAME adapter command and the name of the database in the MDQ file, as defined in the Database Interface Designer.
Using this syntax, the specified MDQ file must be available at run time.
- -DBTYPE
- This adapter command is followed by the type of database (for
example, ORACLE or ODBC) followed, optionally, by
database-specific adapter commands.
This syntax does not use an MDQ file because the database-specific adapter commands provide the information required to connect to the database. For more information about your particular database adapter and database-specific adapter commands, see the adapter-specific documentation in the adapter reference guides.