java - How to restore one record/row in table when testing? -
i conducting junit test on am.
the thing that, in cases there changes values of attributes in 1 row, have delete whole row in table.
how can restore row in java programming way @ end of each test case because don't want change data in db?
thanks!
use merge specific rows update or insert record needed. example:
merge bonuses d using (select employee_id, salary, department_id employees department_id = 80) s on (d.employee_id = s.employee_id) when matched update set d.bonus = d.bonus + s.salary*.01 delete (s.salary > 8000) when not matched insert (d.employee_id, d.bonus) values (s.employee_id, s.salary*.01) (s.salary <= 8000);
in java call preparedstatement, example:
preparedstatement = dbconnection.preparestatement("merge .."); another option isn't use in production flashback can add restore point can return to.
Comments
Post a Comment