dbquery
Runs an SQL query on an external database server.
Syntax
dbquery PROFILE SQL_STATEMENT
Required Parameter
PROFILE
-
JDBC connect profile. You can configure the connect profile in the web console.
SQL_STATEMENT
-
SQL query statement to run. This loads all result sets loaded through JDBC as key-value pairs.
-
You can define input and output parameters that start with a colon (
:
) in the SQL query command.- The input parameter is in the form of
:name
, and a query parameter defined by the set command can be inserted. - The output parameter is defined in the form of
:name(type)
. The available output parameter types arevarchar
,int
anddatetime
.
- The input parameter is in the form of
Usage
-
Load 100 logs from the
weblogs
table.dbquery oracle select * from weblogs where rownum <= 100
-
Load the list of employees for the last week from the
employee
table using the input parameter.# Input parameter: created_at | set created_at = string(dateadd(now(), "day", -7), "yyyy-MM-dd") | dbquery emp select * from employee where created_at >= :created_at