Extensions.SQL.ExecuteUpdate
Jump to navigation
Jump to search
Classification
Name | ExecuteUpdate |
Short Description | An INSERT, UPDATE or DELETE statement or an OTX SQL Extension statement |
Class | Action |
Extension | OTX SQL extension |
Group | SQL related Actions |
Exceptions | CommandException ConnectionException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
ActionRealisation SQL.ExecuteUpdate(ConnectionTerm connection, StringTerm statement, IntegerVariable result);
Description
The ExecuteQuery action executes the given OTX SQL Extension statement, which may be an INSERT, UPDATE or DELETE statement or an OTX SQL Extension statement that returns nothing, such as an OTX SQL Extension DDL statement.
Properties
Name | Data Type | Class | Default | Cardinality | Description |
connection | Connection | Term | - | [1..1] | This element represents an open Connection. |
statement | String | Term | - | [1..1] | Mandatory OTX SQL Extension statement string which is send to the database. |
result | Integer | Variable | - | [0..1] | Returns the row count for OTX SQL Extension Data Manipulation statements or 0 for OTX SQL Extension statements that return nothing. |
OTL Examples
/// Local Declarations
SQL.Connection Connection1;
SQL.ResultSet ResultSet1;
Integer Integer1;
List<Boolean> List1;
/// Flow
try
{
// connect with DotNet platform
Connection1 = SQL.CreateConnection("DRIVER={SQL Server};Server=.;InitialCatalog=classicmodels;username=sa;password=saas");
}
catch (Exception)
{
// connect with Java platform
Connection1 = SQL.CreateConnection("jdbc:sqlserver://localhost;databaseName=classicmodels;username=sa;password=saas");
}
catch (Exception Exception1)
{
throw Exception1;
}
try
{
SQL.ExecuteUpdate(Connection1, "UPDATE classicmodels.dbo.visits SET first_name = N'Steven' ,visited_at = getdate(),phone = N'0123456789',store_id = 19,has_buy_product = 1 WHERE last_name = N'Jorg'", Integer1);
}
catch (SQL.CommandException Exception1)
{
throw Exception1;
}
catch (SQL.ConnectionException Exception1)
{
throw Exception1;
}
finally
{
SQL.CloseConnection(Connection1);
}