
534 N.W.2d 457 (1995)
IOWA DEPARTMENT OF TRANSPORTATION, Plaintiff,
v.
IOWA DISTRICT COURT FOR BREMER COUNTY, Defendant.
No. 94-477.
Supreme Court of Iowa.
July 19, 1995.
*458 Thomas J. Miller, Atty. Gen., David A. Ferree, Sp. Asst. Atty. Gen., and Mark Hunacek, Asst. Atty. Gen., for plaintiff.
No appearance for defendant.
Considered en banc.
TERNUS, Justice.
Does a district court have authority in a criminal case to enter an order that in effect prohibits the revocation of the defendant's driver's license by the Iowa Department of Transportation (DOT)? We think it does not. Therefore, we sustain the DOT's petition for writ of certiorari challenging the legality of the district court's order doing so here.

I. Background Facts and Proceedings.

On May 22, 1993, Garry Lee Schumacher was stopped by a police officer for speeding. Schumacher dropped a marijuana pipe on the floor of the patrol car. A subsequent search of his vehicle revealed a plastic bag of marijuana. Schumacher was charged with operating a motor vehicle while intoxicated (OWI) and possession of a controlled substance. See Iowa Code §§ 321J.2, 124.401(3) (1993). On August 27, 1993, Schumacher pled guilty to the possession charge. The court dismissed the OWI charge.
Between the time that Schumacher committed the offense and the time he was convicted, a new law requiring the DOT to revoke the driver's license of any drug offender became effective. See 1993 Iowa Acts ch. 16, § 4. This law, codified at Iowa Code section 321.209(8) (1995), states:
Mandatory revocation. The department shall upon twenty days' notice and without preliminary hearing revoke the license or operating privilege of an operator upon receiving a record of the operator's conviction for any of the following offenses, when such conviction has become final:
....
8. A controlled substance offense under section 124.401. ...
The DOT sought to apply this new law to Schumacher. Upon learning of Schumacher's conviction for possession of a controlled substance, the DOT notified him that his license was revoked pursuant to section 321.209(8).
Schumacher then filed an application for a nunc pro tunc order in his criminal case. He asked that the district court enter an order that section 321.209(8) did not apply to him because his drug offense was committed before the effective date of the statute. The county attorney consented to the entry of such an order. Six months after Schumacher's conviction, the district court amended its judgment and sentence by adding a statement that the law providing for revocation of drivers' licenses for drug offenses did not apply to Schumacher.
The DOT filed a petition for writ of certiorari challenging the district court's jurisdiction to enter the nunc pro tunc order. Schumacher resisted on behalf of the district court arguing the district court had a duty to consider and decide the applicability of section 321.209(8) in setting an appropriate sentence. He also asserted that the court merely gave effect to the plea agreement between the county attorney and Schumacher which included an understanding that section 321.209(8) would not apply to Schumacher. We find these arguments unpersuasive and hold that the district court had no authority to decide whether section 321.209(8) applied to Schumacher.


*459 II. Scope of Review.

Our review of the district court's action is to correct errors of law. Backstrom v. Iowa Dist. Ct. for Jones County, 508 N.W.2d 705, 707 (Iowa 1993), cert. denied, ___ U.S. ___, 114 S.Ct. 1566, 128 L.Ed.2d 211 (1994); State v. Iowa Dist. Ct. for Clayton County, 419 N.W.2d 398, 399 (Iowa 1988). We will sustain a writ of certiorari where the district court acted beyond its authority or jurisdiction. Iowa Dep't of Transp. v. Iowa Dist. Ct. for Poweshiek County, 530 N.W.2d 725, 726 (Iowa 1995); Backstrom, 508 N.W.2d at 707.

III. Authority of District Court.

The nunc pro tunc proceeding in this criminal case was in essence a request for a declaratory ruling. Schumacher asked the district court to rule that section 321.209 did not apply to him. We have held that when a party seeks a declaratory judgment on a matter "entrusted exclusively in the first instance to an administrative agency," the court must refuse to issue a ruling unless the action "is indistinguishable in substance from a petition for judicial review and all of the jurisdictional prerequisites for judicial review of agency action" have been met. City of Des Moines v. Des Moines Police Bargaining Unit Ass'n, 360 N.W.2d 729, 730 (Iowa 1985). Declaratory relief is not appropriate "when there is a complete remedy otherwise provided by law that is intended to be exclusive." Id. at 731. We think an exclusive administrative remedy exists for the declaratory relief sought here.
Section 321.209 expressly confers on the DOT the duty to revoke a driver's license when that driver has been convicted of a drug offense. Iowa Code §§ 321.209 ("The department shall ... revoke the license..." (emphasis added)), 4.1(30)(a) ("The word `shall' imposes a duty.") (1993). The DOT's action in revoking a driver's license is agency action within the meaning of Iowa Code section 17A.2(2). Tindal v. Norman, 427 N.W.2d 871, 873 (Iowa 1988) (agency's performance of a statutory duty is "agency action" as defined in section 17A.2(2)). Any person who is adversely affected by agency action may seek judicial review of the agency decision. Iowa Code § 17A.19(1) (1993). Most important, the judicial review provisions of chapter 17A are exclusive. Id.; Hollinrake v. Monroe County, 433 N.W.2d 696, 699 (Iowa 1988) (exclusivity of judicial review provision applies to agency's action in carrying out its statutory duty).
Clearly, Schumacher had an adequate administrative remedy to contest the DOT's revocation of his driver's license. Under chapter 17A, he could seek judicial review of the DOT's decision. Because this remedy is exclusive, the district court had no authority to issue a declaratory ruling unless Schumacher's application for nunc pro tunc order met the procedural prerequisites for judicial review under Iowa Code section 17A.19.
We conclude that Schumacher's application did not meet the statutory prerequisites for judicial review. The primary deficiency in the application is that it did not name the DOT as the respondent as required by Iowa Code section 17A.19(4) (1993) ("The petition for review shall name the agency as respondent...."). Although we have found substantial compliance with this requirement where the agency was simply misnamed, Frost v. S.S. Kresge Co., 299 N.W.2d 646, 648 (Iowa 1980), and where a related department and the executive officer of the agency were named rather than the agency, Buchholtz v. Iowa Department of Public Instruction, 315 N.W.2d 789, 792-93 (Iowa 1982), we cannot find substantial compliance here. Only the parties to the criminal case were named in the caption of Schumacher's application. No employee of the DOT or a related entity was named as a respondent so as to alert the DOT that the application sought relief from agency action. To find substantial compliance here would effectively nullify the requirement that the agency be named as a respondent. Therefore, we hold that Schumacher did not substantially comply with section 17A.19(4).[1]
*460 Without the authority obtained in judicial review proceedings, the district court here was without power to consider Schumacher's application for nunc pro tunc order. This conclusion is similar to our holding in Iowa Department of Transportation v. Iowa District Court for Buchanan County, 504 N.W.2d 897 (Iowa 1993). In that case, the district court in a criminal proceeding directed the DOT to remove from the defendant's driving record a 1982 conviction for operating while intoxicated. Iowa Dist. Ct. for Buchanan County, 504 N.W.2d at 897. The county attorney did not object to the court's order, entered long after the criminal conviction became final. Id. The DOT brought a certiorari action challenging the district court's jurisdiction to enter the order. Id. at 897-98. We concluded that the district court exceeded its authority in ordering the DOT to remove the defendant's conviction from his driving record because there was no statute that gave the district court in a criminal case the power to do so. Id. at 898.
The same reasoning applies here. There is no statute that gives the district court in a criminal proceeding the authority to decide whether a license revocation under chapter 321 is appropriate. The district court here acted illegally in doing so. Mandile v. State, 547 So.2d 1062, 1062 (Fla.Dist.Ct.App.1989) (trial court lacked authority in criminal case to suspend defendant's driver's license under mandatory revocation statute similar to section 321.209; appellate court concluded that only the department of highway safety and motor vehicles has that power); see Commonwealth v. Bassion, 568 A.2d 1316, 1320 (Pa.Super.Ct.1990) (court in criminal case has no authority to enter an order dealing with license suspension proceedings).

IV. Effect of Plea Agreement.

Schumacher argued in his resistance to the petition for writ of certiorari that the district court's nunc pro tunc order merely gave effect to the plea bargain to which the county attorney agreed. However, the actions of the county attorney do not change our conclusion that the district court had no authority to determine whether section 321.209 applied to Schumacher.
There are two ways to view the county attorney's agreement that section 321.209 did not apply here. In one sense, Schumacher may have viewed the county attorney's action as an authoritative decision on whether section 321.209 applies where the drug offense was committed before the effective date of the statute. On the other hand, the county attorney's action could be seen as an agreement to waive a license revocation, which the DOT could otherwise seek, in return for Schumacher's guilty plea. However we view the plea agreement here, the county attorney had no authority to do what he did.
We note at the outset that the county attorney does not have any independent authority to issue declaratory rulings on the applicability of the revocation provisions of chapter 321 or to adjudicate the rights of license holders under chapter 321. The DOT is, in the first instance, charged with the responsibility to interpret and enforce the motor vehicle laws governing the revocation of drivers' licenses. Iowa Code § 321.2 (1993) ("The state department of transportation shall administer and enforce the provisions of this chapter."); Heidemann v. Sweitzer, 375 N.W.2d 665, 668 (Iowa 1985).
Additionally, the county attorney did not represent the DOT in the plea negotiations. First, the DOT was not a party to the criminal case. State v. Juarez, 345 N.W.2d 801, 802 (Minn.Ct.App.1984) (parties to criminal proceedings and revocation proceedings are not the same because the state, which prosecutes the criminal case through the local prosecuting attorney, is not the same party as the commissioner of public safety who initiates the revocation proceeding). Secondly, unless specifically provided otherwise, the attorney general, not the county attorney, represents the DOT. Iowa Code § 307.23 *461 (1993); accord State v. House, 291 Minn. 424, 192 N.W.2d 93, 95 (1971) (attorney general, not county attorney, represents state's interests with respect to revocation of drivers' licenses).
Because the county attorney did not represent the DOT in the criminal proceedings and had no independent authority, any representation by the county attorney that section 321.209 did not apply to Schumacher is not binding on the DOT. Cf. Bassion, 568 A.2d at 1320 (because department of transportation was not a party to criminal proceeding, any order entered in criminal case concerning the defendant's operating privileges would not be binding on the department).
For the same reasons, a county attorney does not have the authority to waive the applicability of section 321.209 as part of plea bargaining in a criminal case. State v. House, 192 N.W.2d at 95 (holding that county attorney had no authority to agree during plea negotiations that defendant's driver's license would not be revoked); Commonwealth v. Lefever, 533 A.2d 501, 503 (Pa. Commw.Ct.1987) (holding that district attorney had no power during plea bargaining to bind the state department of transportation to forego license suspension). The administrative penalties of chapter 321 are independent of the criminal sanctions of chapter 124. Iowa Dist.Ct. for Buchanan County, 504 N.W.2d at 898 (recognizing the "clear separation between criminal proceedings involving operating-while-intoxicated prosecutions and administrative proceedings such as the revocation of a motor vehicle license"); Heidemann, 375 N.W.2d at 668 ("license revocation proceedings are separate and distinct from criminal charges arising from the same incident, and `[e]ach action proceeds independently of the other'") (quoting Krueger v. Fulton, 169 N.W.2d 875, 877 (Iowa 1969)); Lefever, 533 A.2d at 503. The fact that a section 321.209(8) revocation is a quasi-criminal penalty, Hills v. Iowa Department of Transportation, 534 N.W.2d 640, 642 (Iowa 1995), does not change the fact that the proceeding to impose that penalty is administrative and is separate from any related criminal charges.
Finally, our conclusion that the county attorney had no authority to make the plea agreement he did is also supported by our opinion in Iowa District Court for Poweshiek County. In that case, we held that the county attorney had no discretion to agree to a two-year revocation rather than the six-year revocation required by the applicable statute. Iowa Dist. Ct. for Poweshiek County, 530 N.W.2d at 728. Our decision was based in part on the fact that the six-year revocation provision was mandatory. Id.
Revocations under section 321.209 are also mandatory. Iowa Code §§ 321.209 ("The department shall ... revoke the license ...") (emphasis added)), 4.1(30)(a) ("The word `shall' imposes a duty."). We can think of no reason to interpret this statute as giving the county attorney, who is not even responsible for enforcement of the statute, the discretion to waive its application. Cf. State v. Pettit, 360 N.W.2d 833, 836 (Iowa 1985) (license revocation required by former Iowa Code section 321.281(9)(a) (1983) for third offense drunk driving was mandatory and district court had no discretion not to order license revocation); see State v. R.N., 597 So.2d 862, 863 (Fla.Dist.Ct.App.1992) (statute directing revocation of driving privileges of juveniles possessing alcoholic beverages did not allow the trial court discretion to apply the statute). Because the revocation required by section 321.209 is mandatory, the county attorney could not use it as a bargaining chip in criminal plea negotiations.[2]

V. Summary.

We conclude that the district court had no authority to adjudicate the applicability of *462 section 321.209(8) in this criminal proceeding. Nor can the court's action be justified on the basis that the court merely gave effect to the plea bargain between the county attorney and Schumacher because the county attorney had no authority in plea negotiations to bind the DOT.
WRIT SUSTAINED.
All Justices concur except SNELL, J., who dissents.
SNELL, Justice (dissenting).
I respectfully dissent.
This case has taken on a life of its own bursting beyond the confines of its simplistic origin. From a minor criminal case the Iowa Department of Transportation has spawned a plethora of legal issues all designed to protect its territory. It complains that the district court has usurped its authority over the domain of drivers' licenses seized to it by the legislature.
The DOT attacks the authority of the district court in a criminal case to make any ruling involving the DOT's administrative act of revoking drivers' licenses. Though the district court is a court of general jurisdiction, the DOT asserts that it cannot decide an issue of law affecting the DOT's authority over drivers' licenses. It argues the district court has no jurisdiction because:
1. The legislature gave the DOT the jurisdiction.
2. The DOT was not notified of this case so it had no chance to defend itself.
3. The district court had no authority to enter a nunc pro tunc order explaining the original intent of its sentence and judgment in the criminal case because this was not an administrative case under section 17A.19.
4. The district court had no authority to enter a nunc pro tunc order in the criminal case explaining the original intent of its sentence and judgment because when the defendant did not appeal in thirty days, although he had no reason to appeal, the jurisdictional door closed on the district court.
In addition, the DOT claims that the district court committed an error of law in ruling that Iowa Code section 321.209(8) (Supp.1993), passed by the legislature to take effect after the offense was committed but before the conviction, did not apply to the defendant. The DOT argues this section applies to automatically revoke a defendant's driver's license because:
1. That is what the legislature intended.
2. The legislation is not ex post facto legislation and therefore does not violate the Iowa and United States Constitutions.
The majority converts the nunc pro tunc proceeding to a request for a declaratory ruling and finds that remedy inappropriate because Iowa Code chapter 17A (1993) provides the exclusive administrative remedy. The court then concludes that no remedy under section 17A.19 is possible because none of four requirements under that section was met by the defendant. A review of the nunc pro tunc application and order, both styled as such, shows that no request for or reference to a declaratory judgment is made regarding a remedy under section 17A.19.
Lost in the tangle over the jurisdiction of the district court is the question "What is the DOT's jurisdiction in this case?" In fact, it has none. There is no offense involving the operation of a motor vehicle for which defendant Schumacher has been convicted. See Westfall v. Commonwealth, 126 Pa.Cmwlth. 88, 558 A.2d 619, 621 (1989). Schumacher pled guilty, was convicted and sentenced for violating section 124.401(3), possession of a controlled substance. The charge of violating section 321J.2, operating while intoxicated, was dismissed by the district court at the time of the guilty plea. Section 124.401(3), possession of a controlled substance, to which Schumacher pled guilty, makes no reference to and does not pertain to the operation of a motor vehicle. There is no conviction in this case of an offense involving the operation of a motor vehicle. The DOT, claiming it has a right to revoke Schumacher's driver's license under section 321.209(8), must base its action "upon receiving a record of the operator's conviction." There is no operator's conviction in this case. The DOT's attempt to *463 broaden its jurisdiction to include every controlled substance conviction, whether an operator's conviction or not, is well beyond its authority.
We have recognized throughout our jurisprudence the right of the district court to amend, correct, or explain its orders by a nunc pro tunc order. In 1924 we said:
In fact, the record in the trial court was later corrected, and an amendment to the return to this court in this proceeding was made. The trial court possessed the inherent authority to enter a judgment nunc pro tunc, and lapse of time will not bar the exercise of this power. Even after the taking of an appeal, the trial court may correct its record to conform to the proceedings therein.
Parenti v. District Court, 198 Iowa 560, 564, 199 N.W. 259, 261 (1924) (citation omitted).
In 1936 we said:
We must not lose sight of the fact that the purpose of a nunc pro tunc entry is to supply or correct a record to make it conform to that which was actually done at an earlier date, and that as between the parties it operates to validate or correct the original judgment. It relates back to the original date, and when entered, is as effectual as though entered of record as originally announced. The purpose of the entry of such an order is to effectuate justice.
Murnan v. Schuldt, 221 Iowa 242, 245, 265 N.W. 369, 371 (1936).
In 1943 we said: "The decisions uniformly hold that courts have inherent power to make orders nunc pro tunc to make their records `speak the truth,' and that lapse of time and statutory limitations are no obstacles to the exercise of such power." Freshour v. Freshour, 233 Iowa 1144, 1147, 11 N.W.2d 375, 376 (1943).
In 1949 we said:
The correction was sought to make the record entry conform to the actual pronouncement of the court, not to evidence a change in the decision itself. Such proceedings are clearly within the inherent power of the court and the existing statutes are merely cumulative.
State v. Harbour, 240 Iowa 705, 710, 37 N.W.2d 290, 293 (1949).
In 1969 we quoted the above from Harbour in Headley v. Headley, 172 N.W.2d 104, 107 (Iowa 1969).
In 1995 we said:
The court later expanded its dismissal order to explain that the action was dismissed because the arresting officer did not have reasonable grounds to believe a violation of section 321J.2 had occurred.
Wiebenga v. Iowa Dep't of Transp., 530 N.W.2d 732, 733 (Iowa 1995).
The district court by its nunc pro tunc order in the case at bar completed the terms intended by the court and the parties under which the guilty plea by Schumacher was made. The county attorney agreed that a condition of the guilty plea was that section 321.209(8) did not apply to the defendant. The district court found that it did not apply as a matter of law. The nunc pro tunc order reflects the true state of the record of the guilty plea proceedings and reflects honorably that the state would not renege on its promises.
We have witnessed in our court in the past an attempt by the state to renege on its promises. State v. Kuchenreuther, 218 N.W.2d 621 (Iowa 1974). In that case a prosecutor made an agreement with the defendant granting immunity. A subsequent prosecutor then proceeded in violation of the state's agreement and obtained a conviction of defendant. Justice Rawlings of our court stated: "... we are persuaded the prosecution and conviction of this defendant on a felony charge, if allowed to stand, would undermine our system of justice." Id. at 623. Quoting with approval from United States v. Carter, 454 F.2d 426, 427-28 (4th Cir.1972), cert. denied, 417 U.S. 933, 94 S.Ct. 2646, 41 L.Ed.2d 237 (1974), our court said:
[W]e conclude that if the promise was made to defendant as alleged and defendant relied upon it in incriminating himself and others, the government should be held to abide by its terms. [I]f, after having utilized its discretion to strike bargains with potential defendants, the Government seeks to avoid those arrangements by using *464 the courts, its decision so to do will come under scrutiny. If it further appears that the defendant, to his prejudice, performed his part of the agreement while the Government did not, the indictment may be dismissed.
There is more at stake than just the liberty of this defendant. At stake is the honor of the government, public confidence in the fair administration of justice, and the efficient administration of justice in government.
Kuchenreuther, 218 N.W.2d at 623-24 (citation omitted).
The DOT as well as the county attorney and district court are representatives and arms of the state of Iowa. As such, all are bound by the rules of honor and law stated in Kuchenreuther, 218 N.W.2d at 623-24.
I would annul the DOT's application for a writ of certiorari.
NOTES
[1]  Additionally, Schumacher's application did not include a concise statement of the "facts on which venue is based" as required by section 17A.19(4)(c). A petition for judicial review may be filed in Polk County or in the county where the petitioner resides. Iowa Code § 17A.19(2) (1993). Schumacher did not file his application in Polk County and there are no facts in the application which reveal whether Schumacher resided in Bremer County when he filed the application. Finally, Schumacher filed no affidavit that the application was mailed to the DOT as required by section 17A.19(2).
[2]  The fact that ultimately the DOT may not have been successful in revoking Schumacher's license under section 321.209(8), see Hills v. Iowa Department of Transportation, 534 N.W.2d 640 (Iowa 1995), is irrelevant to whether the county attorney had the power to use a potential license revocation as a bargaining item during plea negotiations. The determinative fact is that under the statutory scheme, license revocation is not part of the criminal sentence but rather is imposed administratively. Consequently, the county attorney had no authority in a criminal case to decide whether to forego an administrative penalty.
