If a judgment of acquittal is given on a general verdict, and the defendant is not detained for any other legal cause, he must be discharged as soon as judgment is given, except that when the acquittal is for a variance between the proof and the indictment or information which may be obviated by a new indictment or information the court may order his detention to the end that a new indictment or information may be preferred in the same manner and with like effect as provided in cases where the jury is discharged.
Okla. Stat. tit. 22, § 923