
969 P.2d 498 (1999)
93 Wash.App. 520
STATE of Washington, Petitioner,
v.
Michael D. EPLER, Respondent.
No. 16702-0-III.
Court of Appeals of Washington, Division 3, Panel One.
January 5, 1999.
*499 Kathryn Lee, Deputy Prosecutor, Spokane, for Petitioner.
Carl E. Hueber, Winston & Cashatt, Spokane, for Respondent.
Sherrie Wright, Spokane, pro se.
SWEENEY, A.C.J.
Michael D. Eler was tried in district court on June 14, 1996, on a charge of driving while under the influence (DUI). The trial judge declared a mistrial after the jury deadlocked. The State sought a new trial on the DUI and added a new charge of reckless driving based on the same incident. Mr. Epler moved to dismiss the reckless driving charge on double jeopardy grounds. The State then voluntarily dismissed the reckless driving charge but not the DUI.
Mr. Epler next moved for a dismissal with prejudice on the DUI pursuant to CrRLJ 8.3(b), alleging arbitrary action and misconduct by the State with resulting prejudice. He argued that, by attempting to prosecute the reckless driving charge after failing to join it with the first DUI prosecution, the State violated the mandatory joinder provisions of CrRLJ 4.3, which constituted prejudicial misconduct. The prejudice alleged included the expenditure of time, money, and emotion, which diminished his ability to focus on his DUI defense. The district court denied the motion.
Mr. Epler petitioned the superior court for writs of stay and review. His supporting affidavit alleged the district court "committed a clear error at law, [for] which there is no remedy." In a second affidavit, Mr. Epler argued the State was "out to get" him. On October 7, 1996, the superior court issued a writ to the district court staying the proceedings and granting review.
Pursuant to the writ, on March 17, 1997, Superior Court Judge Rielly held a de novo hearing on the motion to dismiss. The district court record before the superior court (and this court) was counsels' memoranda. The superior court reviewed the briefs of counsel and several affidavits that were not before the district court, and heard oral argument from the lawyers. Mr. Epler argued for the first time that he lost a key defense witness because the State joined and then dismissed the reckless driving charge.
Other new evidence included the affidavit of Kaysey Orlowski that she would refuse to testify at a second trial because she was "overwhelmed with the vindictiveness of the system" after the reckless driving charge. Ms. Orlowski was Mr. Epler's passenger at the time of the alleged DUI and a witness for the defense at the first DUI trial. The State did not object to the additional affidavits. Judge Rielly ordered the district court to dismiss the DUI with prejudice pursuant to CrRLJ 8.3(b). The State's motion for reconsideration was denied.
*500 We granted the State's petition for discretionary review.
The threshold, and dispositive, question is whether the superior court had authority to issue the writ of review. It did not.
This is a jurisdictional question not raised by the parties in their briefs. But the parties were advised of the issue and invited to argue. RAP 10.1(h). The question of subject matter jurisdiction may be raised at any time. RAP 2.5(a)(1); In re Saltis, 94 Wash.2d 889, 893, 621 P.2d 716 (1980).

DISCUSSION
The superior court's decision to issue a writ of certiorari is reviewed de novo. Saldin Sec., Inc. v. Snohomish County, 80 Wash.App. 522, 527, 910 P.2d 513 (1996), aff'd, 134 Wash.2d 288, 949 P.2d 370 (1998).
Writs are of two varieties: the constitutional common law writ and the statutory writ. Bridle Trails Community Club v. City of Bellevue, 45 Wash.App. 248, 252, 724 P.2d 1110 (1986). The Washington Constitution empowers the superior court to issue a writ of review on a petition by a person in actual custody, and other appellate power as prescribed by statute. Wash. Const. art. IV, § 6. Mr. Epler was not in custody. The writ at issue, therefore, is statutory.
District court interlocutory orders in criminal proceedings are subject to review in the superior court by a statutory writ of review. RCW 35.20.030; State v. Cascade Dist. Court, 24 Wash.App. 522, 525, 603 P.2d 1264 (1979). The Rules for Appeal of Decisions of Courts of Limited Jurisdiction (RALJ) do not apply to writ proceedings. RALJ 1.1(b). Statutory writs are governed by RCW 7.16. City of Seattle v. Williams, 101 Wash.2d 445, 454, 680 P.2d 1051 (1984).
The superior court can grant a writ of review only if: (1) the district court exceeded its jurisdiction or acted illegally, and (2) there is no appeal or adequate remedy at law. RCW 7.16.040. Unless both elements are present, the superior court has no jurisdiction for review. Williams, 101 Wash.2d at 445, 680 P.2d 1051.
Here, neither requirement is satisfied: the district court was squarely within its jurisdiction, and review on appeal is an adequate remedy.
District court jurisdiction. Mr. Epler's affidavit in support of the writ did not even allege lack of jurisdiction. He complained only that the district court committed a clear error at law. This is not enough.
The threshold for a discretionary writ is not whether the district court committed error of law, but whether the court had jurisdiction to decide the motion. State ex rel. New York Cas. Co. v. Superior Court, 31 Wash.2d 834, 837-38, 199 P.2d 581 (1948). If the court has subject matter jurisdiction, a merely erroneous ruling is not an act in excess of the court's jurisdiction, and therefore no writ lies. State ex rel. Moore v. Houser, 91 Wash.2d 269, 286-87, 588 P.2d 219 (1978). The court's exercise of its discretion is not reviewable by extraordinary writ. State ex rel. O'Brien v. Police Court, 14 Wash.2d 340, 346, 128 P.2d 332, 141 A.L.R. 1257(1942); State ex rel. Panos v. Superior Court, 188 Wash. 382, 62 P.2d 1098 (1936). Here, the district court's jurisdiction and discretion to rule on a CrRLJ 8.3(b) motion are expressly conferred by the rule and were exercised at Mr. Epler's request.
Some circumstances deprive a court of jurisdiction to deny a motion to dismiss a criminal trial. City of Seattle v. Hesler, 98 Wash.2d 73, 75, 653 P.2d 631 (1982) (denial of a jury in a criminal trial); Butts v. Heller, 69 Wash.App. 263, 848 P.2d 213 (1993) (clear violation of the speedy trial rule); State v. Harris, 2 Wash.App. 272, 469 P.2d 937 (1970) (unequivocal double jeopardy), rev'd on other grounds, 78 Wash.2d 894, 480 P.2d 484, reinstated, 404 U.S. 55, 92 S.Ct. 183, 30 L.Ed.2d 212 (1971). But none of these cases involves discretionary rulings. They address clear violations of mandatory constitutional provisions or court rules that unequivocally prohibit trial. No case holds that even a clearly erroneous discretionary ruling on a motion to dismiss under CrRLJ 8.3 deprives the court of jurisdiction to proceed. And for good reason the rulings are discretionary with the district court judge.
*501 There is an adequate remedy at law. The fact that an appeal will not lie directly from an interlocutory order is not a sufficient basis for a writ of review if there is an adequate remedy by appeal from the final judgment. State ex rel. Seattle General Contract Co. v. Superior Court, 56 Wash. 649, 106 P. 150 (1910).
Before the introduction of the RALJ, every review of a district court decision was by trial de novo in superior court. Because the trial de novo did not reach the propriety of interlocutory orders, the denial of a motion to dismiss was properly challenged by means of an extraordinary writ. State v. Mandel, 23 Wash.App. 562, 565-66, 597 P.2d 443, review denied, 92 Wash.2d 1035 (1979).
Under the RALJ, an interlocutory order is reviewable on appeal from the ultimate judgment. So absent a showing that the appeal is inadequate, certiorari does not lie. Hall v. American Nat'l Plastics, Inc., 73 Wash.2d 203, 204-05, 437 P.2d 693 (1968) (citing State ex rel. Harris v. Superior Court, 34 Wash. 248, 75 P. 809 (1904); Jones v. Paul, 56 Wash. 355, 105 P. 625 (1909); Wilson v. McGillivray, 58 Wash. 291, 108 P. 620 (1910)). Generally, an order having the effect of granting a new trial is appealable. Burke v. Northern Pac. Ry., 80 Wash. 188, 189, 141 P. 364 (1914). But in these cases, the court was deemed to lack jurisdiction to conduct a trial and therefore the remedy of appeal was also deemed inadequate.
The denial of a CrRLJ 8.3(b) motion to dismiss is routinely reviewed on appeal from the final judgment. See, e.g., State v. Michielli, 132 Wash.2d 229, 937 P.2d 587 (1997).
The decision of the superior court is reversed.
BROWN and KATO, JJ., concur.
