Row Count from EXECUTE IMMEDIATE statement

I’ve written a few stored procedures for CRUD operations against a table. They all follow the general form:

    update_sql = 'UPDATE table SET column1 = "some value" where id in (1,2,3)' ;
    EXECUTE IMMEDIATE delete_sql ;

However calling these procedures will return a response saying ‘0 row(s) affected’.
Is there some way to get the affected row count from an EXECUTE IMMEDIATE type query?

Something similar to how Oracle does it maybe?

                         || some_sql
                         || '; :rec_count := SQL%ROWCOUNT; COMMIT; END;'
            USING OUT rec_count;


1 Like

Figured it out. The following works for me:

EXECUTE IMMEDIATE CONCAT(update_sql, ' ECHO SELECT row_count() ;') ;

Thanks for sharing that.