Jayson
Jayson

Reputation: 2193

how to set a update warning for update too many rows

I wanna to stop these query which will update more than 10k row at once.

just like mysql workbench, if i update a table without where condition, it will give me a warning and stop execute the sql.

Upvotes: 0

Views: 136

Answers (1)

ajreal
ajreal

Reputation: 47321

there is no built-in function for this

before you sending the update statement,
you will need to execute the filter condition (ie . SELECT COUNT(*) FROM TBL WHERE...
in order to get the count of matched rows

from there, you can determine whether it should prompt a warning or not

Upvotes: 2

Related Questions