i was wondering if it is possible to execute multiple sql statements in 1 go. For example the scenario that i want to delete rows from multiple tables, is there a way i can do things like..
<delete id="delete" parameterType="String">
DELETE FROM DUMMYTABLE_A where X=${value}
DELETE FROM DUMMYTABLE_B where X=${value}
</delete>
I'm using myBatis with Oracle. I guess there is something similar in other DB. Actually you always can create procedures in DB, which usually is better for the future, when you have to support the project.
<delete id="deleteUnfinishedData" parameterType="map">
{call
declare
begin
delete from TABLE1 where id = #{valueFromMap1};
delete from TABLE2 where id = #{valueFromMap2};
end
}
</delete>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With