When the answer pleads that the action is barred by the statute of limitations, or by a prior judgment, or that another action is pending upon the same cause of action, or sets up any other defense not involving the merits of the plaintiff’s cause of action but constituting a bar or ground of abatement to the prosecution thereof, the court may, either upon its own motion or upon the motion of any party, proceed to the trial of the special defense or defenses before the trial of any other issue in the case, and if the decision of the court, or the verdict of the jury, upon any special defense so tried (other than the defense of another action pending) is in favor of the defendant pleading the same, judgment for the defendant shall thereupon be entered and no trial of other issues in the action shall be had unless that judgment shall be reversed on appeal or otherwise set aside or vacated; and where the defense of another action pending or a demurrer based upon subdivision (c) of Section 430.10 is sustained (and no other special defense is sustained) an interlocutory judgment shall be entered in favor of the defendant pleading the same to the effect that no trial of other issues shall be had until the final determination of that other action, and the plaintiff may appeal from the interlocutory judgment in the same manner and within the same time as is now or may be hereafter provided by law for appeals from judgments. If the decision of the court, or the verdict of the jury, upon the special defense or defenses so tried is in favor of the plaintiff, trial of the other issues shall thereafter be had either upon the court’s own motion or upon the motion of any party, and judgment shall be entered thereon in the same manner and with the same effect as if all the issues in the case had been tried at one time. In such an event any and all decisions or verdicts upon the special defense or defenses, and all rulings on the trial thereof shall be deemed excepted to and may be reviewed on motion for a new trial or upon appeal from the judgment.
This section also applies to the trial of special defenses pleaded in an answer to a cross-complaint or a demurrer based upon subdivision (c) of Section 430.10, and if the decision of the court or the verdict of the jury upon the special defense or defenses is in favor of the cross-defendant, no further trial shall be had upon the issues raised by the cross-complaint, but trial of the other issues in the action shall thereafter be had either upon the court’s own motion or upon the motion of any party, and after the trial thereof the judgment shall be entered in the action as is justified by the decision or verdict on such other issues, considered in connection with the decision or verdict upon the trial of such an affirmative defense raised in the answer to the cross-complaint.
(Amended by Stats. 1986, Ch. 540, Sec. 11.)