2 Ways to Return the Number of Rows Changed by a SQL Statement in SQLite

SQLite provides several ways to determine how many rows are affected by SQL statements such as INSERT, UPDATE or DELETE.

One way of achieving this is with the changes() function. This function returns the number of rows modified by the most recent SQL statement executed in the current session.

Another way is with the .changes dot command.

In this article, we’ll look at an example that uses these options to get the number of rows changed by various SQL statements.

Continue reading

Fix “Out of Range Error” When Using GENERATE_SUBSCRIPTS() in DuckDB

If you’re getting an “Out of Range Error” when using the generate_subscripts() function in DuckDB, it could be that you’re specifying a non-existent dimension for the array.

DuckDB’s generate_subscripts() function accepts the array as the first argument, and the dimension as the second argument. The second argument must correspond to an actual dimension present in the array.

To fix this issue, be sure to specify a dimension that actually exists in the array.

Continue reading