OPINION
Opinion by
Justice LANG-MIERS.Relator filed this mandamus proceeding to prevent respondent, presiding judge of the County Criminal Court No. 2 of Dallas County, Texas, from enforcing its order requiring the State of Texas to produce information in the National Crime Information Center (NCIC)1 about its law enforcement witnesses to the court for an in-camera inspection. Relator contends that the order is void because it exceeds the *704trial court’s authority to order pretrial discovery in a criminal case. We conditionally grant the writ.
Factual and Procedural Background
Real Party in Interest, the defendant in the criminal proceeding below, filed an omnibus pretrial discovery motion in which he asked to discover, among other things, the criminal records of and any pending charges against witnesses to be called to testify by the State. The court held a pretrial hearing in which the defendant’s motion was heard. At the beginning of the hearing, the State disclosed that it had spoken with the two law enforcement officers listed as witnesses and both of them stated they had never been arrested, confined, or charged by information or indictment for any offense. The State also disclosed that one of the officers had two internal affairs investigations against him for use of excessive force and that he had been exonerated on both complaints. That officer also indicated that he had been named in a civil lawsuit against his police department for -wrongful arrest and that the civil lawsuit was still pending.
After a discussion of other pretrial matters, the trial court went through the defendant’s omnibus motion making rulings on the requests. Request No. 15 asked for “Criminal History of Witness” and stated:
Defendant requests that the Court order the State to produce, prior to trial, any and all criminal records of State’s witnesses, as well as juvenile records, that they intend to call to the stand in the trial of this case, and further, to determine and disclose any pending charges that the witnesses may have.
The court asked defense counsel if she had received a criminal history of the State’s witnesses, and she said “No, ma’am.” The following then occurred:
THE COURT: So you’ve received no criminal histories of the officers on this case?
[DEFENSE COUNSEL]: No, ma’am: Other than our earlier discussion off the record, Judge.
THE COURT: Are you asking for that information in your pretrial motion?
[DEFENSE COUNSEL]: Yes, Judge, we would ask for that information.
THE COURT: The Court is ordering the information in the NCIC history of the law enforcement officers involved in this case for an in-camera inspection within — by 9:45 this morning. Your Motions in Limine — actually that will be by 9:40 this morning....
The record reflects that the trial court took a short break and when the hearing resumed, the prosecutor “failed to come into the courtroom at the request of both the Sheriff and the judge.” The trial court asked defense counsel if she had received “any more information regarding the criminal records of the State’s witnesses in this trial, including law enforcement^]” Counsel said she had received information about the complainant, but had not received any information about the police officers. At that point, a different prosecutor joined the hearing, and the following occurred:
THE COURT: Okay. I have yet to receive the State’s NCIC/TCIC on the law enforcement witnesses involved in this case for an in-camera inspection. Do you have it with you now?
[THE STATE]: I do not.
THE COURT: Okay. At this time, is it your representation to the Court that you are not going to follow the Court’s order?
[THE STATE]: Yes, Your Honor.
The court held the prosecutor in contempt and placed her in the custody of the Dallas County Sheriffs Department. The *705court ultimately suspended the contempt for 24 hours and allowed the prosecutor to remain free without bond until the next day when the hearing resumed. The next day, the court called the case and asked Relator, who appeared on behalf of the State, whether it had filed a petition for a writ of mandamus challenging the court’s order. Relator said a mandamus action had been filed, and the court withheld any further rulings in the case pending “some direction from the Court of Appeals.”
Discussion
Mandamus is appropriate in a criminal proceeding when the relator establishes: 1) “that he has no adequate remedy at law to redress the harm that he alleges will ensue,” and 2) “that the act he seeks to compel or prohibit does not involve a discretionary or judicial decision.” Simon v. Levarlo, 306 S.W.3d 318, 320 (Tex.Crim.App.2009) (orig. proceeding); see State of Tex. ex rel. Hill v. Court of Appeals for the Fifth Dist., 34 S.W.3d 924, 927 (Tex.Crim.App.2001) (orig. proceeding).
While a trial court has a ministerial duty to rule upon a motion that is properly and timely presented to it for a ruling, in general it has no ministerial duty to “rule a certain way on that motion.” By this we mean that mandamus or prohibition will not lie to “compel the trial court ‘to rule a certain way’ on an uncertain and unsettled issue the resolution of which involved a fair amount of discretion.” In short, it is improper to order a trial court to exercise its judicial (as opposed to its ministerial) function in a particular way unless the relator has a “clear right to the relief sought,” i.e., the law he invokes is definite, unambiguous, and unquestionably applies to the indisputable facts of the case. Even when the facts are undisputed, the extraordinary mechanism of a writ of prohibition or mandamus will not lie to resolve “a hotly contested unsettled ‘question of law.’ ”
Simon, 306 S.W.3d at 321 (internal citations omitted).
Relator argues that the trial court exceeded its authority under article 39.142 of the Texas Code of Criminal Procedure regarding discovery in a criminal case and Brady v. Maryland, 373 U.S. 83, 83 S.Ct. 1194, 10 L.Ed.2d 215 (1963), by ordering “the State to conduct an independent investigation by initiating TCIC/NCIC searches and to provide the results of those searches to the trial court for inspection by the trial court.” Relator argues that the trial court “has persisted in the order despite the fact that the [defendant] has made- no showing that any such evidence exists and has made no showing of good cause as required by Texas law.” Relator argues that the defendant does not have a general right to discovery in a criminal case and that the State does not *706have an independent duty to seek out Brady material on behalf of a defendant.
The State has a constitutional obligation to disclose evidence favorable to the defendant whether or not the defendant requests it. Brady, 373 U.S. at 87-89, 83 S.Ct. 1194; United States v. Bagley, 473 U.S. 667, 682, 105 S.Ct. 3375, 87 L.Ed.2d 481 (1985). This includes evidence that may be used to impeach a witness’s credibility. Bagley, 473 U.S. at 676, 105 S.Ct. 3375. One way to impeach a witness is by introducing evidence of a prior criminal conviction of that witness. Davis v. Alaska, 415 U.S. 308, 316, 94 S.Ct. 1105, 39 L.Ed.2d 347 (1974). To the extent the State obtained information containing Brady material, including from NCIC records, the State was obligated to disclose that information. Brady, 373 U.S. at 87-89, 83 S.Ct. 1194; Bagley, 473 U.S. at 676, 105 S.Ct. 3375.
Relator’s primary complaint in this mandamus proceeding, however, is that the court exceeded its authority by ordering the State to create documents that it did not have. To support its argument, Relator attached to its petition several affidavits of prosecutors. One of those affidavits states, “At the time the order was handed down, no such record existed.” But the mandamus record shows that the State never advised the trial court that “no such record existed” and, as a result, the trial court did not have the benefit of that information at the time the court made its ruling. See Perry v. Del Rio, 66 S.W.3d 239, 261 (Tex.2001) (stating review is limited to record before trial court at the time of ruling). Additionally, we do not construe the court’s order as an order to create a document. The trial court ordered the State to produce “the information in the NCIC history of the law enforcement officers involved in this case for an in-camera inspection.” Because the State never advised the trial court that its order would require the State to create a document, the trial court never had an opportunity to rule on that issue.
Relator also argues that a court order requiring the State to access “previously unaccessed” NCIC records is illegal. Relator attached to its petition a 2001 letter from the Federal Bureau of Investigation concerning access to and disclosure of federal criminal history record information and a chain of emails on that subject. But the letter and the emails were not offered into evidence before the trial court and are not part of the mandamus record. Relator does not cite any exception to the authority that our review is limited to the record before the trial court at the time the trial court ruled. See Del Rio, 66 S.W.3d at 261.
We conclude that, to the extent the trial court ordered the State to produce Brady material in the State’s possession for an in-camera inspection, Relator has failed to show a clear right to the relief sought.
But if the State had not already obtained the information about the law enforcement witnesses, neither Brady nor article 39.14 imposes a duty on the State to obtain that information. See Kyles v. Whitley, 514 U.S. 419, 437-38, 115 S.Ct. 1555 (1995); Tex.Code Crim. Proo. Ann. art. 39.14 (applying to discovery of tangible things in State’s file); see also In re Stormer, No. WR-66865-01, 2007 WL 1783853, at *2 (Tex.Crim.App. June 20, 2007) (not designated for publication) (holding article 39.14 does not give trial court authority to order State to create a document that does not currently exist); Harm v. State, 183 S.W.3d 403, 406-07 (Tex.Crim.App.2006) (holding that Brady obligation attaches when information comes into State’s possession and State not required to seek out Brady material); ef. In re Dist. Attorney’s Office of the 25th *707Judicial Dist., 358 S.W.3d 244, 245-46 (Tex.Crim.App.2011) (stating that article 39.14 supports trial court’s order that State make a copy of a DVD in its file for defendant).
Article 39.14 authorizes a judge to order the State to allow discovery of tangible objects that are not privileged and that are in the State’s possession. State ex rel. Wade v. Stephens, 724 S.W.2d 141, 144. But to obtain discovery under article 39.14, a defendant must show good cause for discovery of the item, the item is material to the defense, and the item is possessed by the State. Id. (citing Hoffman v. State, 514 S.W.2d 248, 252 (Tex.Crim.App.1974)).
In his omnibus motion, the defendant in this case requested the criminal records of the State’s witnesses, and, in fact, the record shows that the State provided more than just information about the officers’ criminal records; it also advised the defendant and the trial court about internal affairs complaints and a civil case pending against one of the officers. At the hearing on his motion, the defendant did not ask the trial court to order the State to produce NCIC records on those witnesses. Defense counsel acknowledged in the hearing that she had received information in the “discussion off the record,” but said she had not received the criminal histories of the law enforcement witnesses in this case and “would like that information.” We note that in response to Relator’s petition, counsel concedes that “[s]ome oral representations concerning criminal history of the law enforcement witnesses had been made by one of the prosecutors at an earlier point in the pre-trial proceedings.”
In addition to no oral or written request for NCIC records of the law enforcement witnesses in this case, there is no oral or written showing of good cause for those records, no oral or written showing why those records are material to the defense, and no oral or written showing that those records are in the State’s possession. As a result, we conclude that the trial court exceeded its authority under article 39.14 when it ordered the State to produce information in the NCIC records for an in-camera inspection.
Relator has shown that he does not have an adequate remedy by appeal because an appeal from a final judgment will not protect Relator from having to produce improper discovery. See Dickens v. Court of Appeals for Second Supreme Judicial Dist. of Tex., 721 S.W.2d 542, 548 (Tex.Crim.App.1987) (orig. proceeding) (“an appeal may become an inadequate remedy from pretrial discovery orders if a relator could not receive relief on appeal”). Accordingly, we conditionally grant Relator’s petition for writ of mandamus. A writ will issue only if the trial court fails to vacate her February 2, 2012 order requiring Relator to produce information in the NCIC history of the law enforcement witnesses in this case.
. Relator complains that the trial court ordered the State to create records from both the National Crime Information Center and the Texas Crime Information Center, but the record shows that the trial court ordered the State to produce only "the information in the NCIC history...."
. Article 39.14 of the Texas Code of Criminal Procedure states in relevant part:
Upon motion of the defendant showing good cause therefor and upon notice to the other parties ... the court in which an action is pending shall order the State before or during trial of a criminal action therein pending or on trial to produce and permit the inspection and copying or photographing by or on behalf of the defendant of any designated documents, papers, written statement of the defendant, (except written statements of witnesses and except the work product of counsel in the case and their investigators and their notes or report), books, accounts, letters, photographs, objects or tangible things not privileged, which constitute or contain evidence material to any matter involved in the action and which are in the possession, custody or control of the State or any of its agencies ....
Tex.Code Crim. Proc. Ann Art. 39.14(a) (West Supp.2011).