SELECT nextval('batch_log_seq') INSERT INTO batch_log (id, type, status, start_at, created_at, created_host) VALUES (#{id}, #{type}, #{status}, #{startAt}, now(), #{hostName}) SELECT nextval('batch_log_seq') INSERT INTO batch_log (id, type, status, error_message, start_at, created_at, created_host) VALUES (#{id}, #{type}, #{status}, #{errorMessage}, now(), now(), #{hostName}) UPDATE batch_log SET status = #{status}, error_message = #{errorMessage}, end_at = now(), created_host = #{hostName} WHERE id = #{id}