Forum OpenACS Q&A: Response to Deleting a row in db_foreach

Collapse
Posted by Ben Adida on
statement names are used for multi-DB compatibility. You can place your query in a separate file (.xql, -oracle.xql, -postgresql.xql) and use the name to point to it with the query dispatcher.

As for deleting the rows, you can select the rowid field which exists for every PG table, or the oid field which exists for every Oracle table, and use that to key your delete.

In most cases, I would suggest you keep a Tcl list of your IDs and delete them after your db_foreach loop. But it depends on your exact application.