Database Custom Actions
<ora:sqlQuery>
The <ora:sqlQuery>
action
executes a SQL
SELECT statement and makes the result available as
a java.util.Vector of
com.ora.jsp.sql.Row objects. The SQL statement is
specified in the body of the action element. Placeholder characters
(question marks) can be used in the statement and given values
dynamically by nested value action elements (see Section 3.3.5 later in this appendix for details).
The attributes supported by the
<ora:sqlQuery> action are described in Table 3.16.
Table C-16. <ora:sqlQuery> Attributes
|
Attribute Name |
Java Type |
Request-TimeValue Accepted |
Description |
|---|---|---|---|
dataSource |
String |
No |
Mandatory, unless used with
|
id |
String |
No |
Mandatory. The name of the vector to hold the result. |
scope |
String |
No |
Optional. The scope for the result, one of |
Example:
<%--
Get all rows from a table where a column matches the value
of a request parameter.
--%>
<ora:sqlQuery id="empDbInfo" dataSource="example">
SELECT * FROM Employee
WHERE UserName = ?
<ora:sqlStringValue param="userName" />
</ora:sqlQuery><ora:sqlTransaction>
The
<ora:sqlTransaction>
action is used to
enclose other database action elements that together make up a
database transaction: a set of database operations where all
operations either fail or succeed. The attribute supported by this
action is described in Table 3.17.
Table C-17. <ora:sqlTransaction>Attribute
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access