Skip to main content
Archived

SQLExecutor: Expose affected rows count

Related products:Transformers
  • August 29, 2016
  • 1 reply
  • 21 views

Forum|alt.badge.img

Currently I have to use 2 statements to handle it, one plain SELECT COUNT(*) AS NUMBER FROM TABLE WHERE CONDITION, and the second statement performs actual update/deletion. It would be useful if SQLExecutor is able to expose number of rows affected bu UPDATE, DELETE commands.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

takashi
Celebrity
  • August 29, 2016

That could be a useful function, but in some database formats, you can do that with a SQL statement. In PostgreSQL, for example, you can use the "returning" parameter in delete/update statement to get affected rows. These statements return the number of deleted/updated rows.

FME_SQL_DELIMITER ; with deleted_rows as (delete from <table name> where <condition> returning *) select 'delete' as command, count(*) as num_affected from deleted_rows; with updated_rows as (update <table name> set <column>=<value> where <condition> returning *) select 'update' as command, count(*) as num_affected from updated_rows;

FYI.