Skip to content

DB Execute

Type: db-execute  ·  Package: Database Activities v1.0.0  ·  Output: int

Executes a statement that modifies data—INSERT, UPDATE, or DELETE—and returns the number of rows affected. It is the writing activity in the database: inserting records, updating states, deleting data.

Executes the statement on the connection and returns how many rows it changed. Uses parameters @nombre and field params for variable values ​​(see parameterized queries).

ParameterEditorDescription
sqlexpressionThe statement INSERT, UPDATE or DELETE. Use @nombre for parameters.
ParameterEditorDescription
sessionsessionDB Connect session. Within a body it is inherited automatically; outside, pass = db.
paramsJSONParameter values, as object { nombre: valor }.

Returns a int with the number of rows affected. Useful to verify that the operation impacted what was expected.

Mark an order as shipped:

DB Execute
sql = "UPDATE Pedidos SET Estado = @estado WHERE Id = @id"
params = { "estado": "despachado", "id": = pedidoId }
→ output: filasAfectadas
If condition = = filasAfectadas == 0
└─ then:
Log level = warning message = = "Ningún pedido con id " + pedidoId