sql:delete
Executes a SQL DELETE statement, returning no result.
delete($connection as javatype:java.sql.Connection, $table as xs:string, $predicate as xs:string) ➔ item()?
Arguments | |||
| $connection | javatype:java.sql.Connection | A JDBC database connection established using sql:connect |
| $table | xs:string | The database table from which rows are to be deleted |
| $predicate | xs:string | A SQL predicate identifying the rows to be deleted |
Result | item()? |
Namespace
http://saxon.sf.net/sql
Notes on the Saxon implementation
Introduced in Saxon 9.9. Designed to supersede the extension instruction sql:delete. The saxon9-sql.jar
file,
distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
are used.
Details
The function executes a SQL DELETE statement, and returns no result.
The statement is constructed simply by concatenating the arguments: DELETE {$table} WHERE {$predicate}
.
Although the declared return type is item()?
, the function always returns an empty
sequence. The declared return type is designed to prevent the optimizer making unwarranted assumptions.
Because this function is executed for its side-effects, it is recommended to invoke it using the saxon:do extension instruction.
Example:
<saxon:do action="sql:delete($connection, 'book', 'price > 20.00')"/>