exec_row
Executes a row-oriented SQL statement.
Available in:
Apps (win) |
Apps (char) |
Reportwriter |
RPC |
Standalone PL |
X |
X |
X |
X |
X |
Syntax
int exec_row(statement[,host-variable,...])
string statement
expr host-variable
Description
Uses the current database connection to determine the
name of the unique row identification column. For example, Oracle uses
ROWID and Rdb uses DBKEY. The host variable reference character varies
between databases. To maintain database portability, use the Oracle ``:n''
notation. All other systems replace the ``:n'' with ``?'' notation.
Adds a database-specific unique row identification column to the
WHERE clause of a statement and executes it. Returns
the number of affected rows for UPDATE and DELETE.
For other operations, it returns zero (0).
If an error occurs in the SQL statement and exec_row() is part of an
expression, the function returns -1.
statement | specifies the SQL statement to execute.
|
host-variable | (optional) specifies the bind variables (either
as variables or hard-coded) for the statement. If
host-variable is a list, all host-variable references are
resolved from the list.
If exec_proc() isn't specified, the function escapes to the
window trigger error trap (TRIMapp) operating system command shell
(TRIMreport or stand-alone TRIMpl systems).
|
Example
Deletes a particular window list row from the database. The row identification
value is in the first column of the window list.
{
.
exec_row("DELETE FROM staff WHERE :1 = ",list_curr(p.wl,0));
.
}
Deletes several rows from the database.
{
list dl; /* dl has 1 column */
exec_row("DELETE FROM staff WHERE :1 = ",dl);
}