Using a Searched Delete
Go Up to Deleting Multiple Rows
Use a searched delete to remove a number of rows that match a condition specified in the WHERE
clause. For example, the following C code fragment prompts for a country name, then deletes all rows that have cities in that country:
. . . EXEC SQL BEGIN DECLARE SECTION; char country[26]; EXEC SQL END DECLARE SECTION; . . . main () { printf("Enter country with cities to delete: "); gets(country); EXEC SQL DELETE FROM CITIES WHERE COUNTRY = :country; if(SQLCODE && (SQLCODE != 100)) { isc_print_sqlerr(SQLCODE, isc_status); EXEC SQL ROLLBACK RELEASE; } else { EXEC SQL COMMIT RELEASE; } }