If judgment of acquittal is given on a general verdict and the defendant is not detained for any other legal cause, the defendant shall be discharged as soon as the judgment is given, except that, when the acquittal is for variance between the proof and the accusatory instrument, which may be obviated by a new accusatory instrument, the court may order the detention of the defendant, to the end that a new accusatory instrument may be preferred, in the same manner and with like effect, as provided in ORS 135.540.
ORS 136.490