Russell Spears (defendant) was arrested for and eventually charged by bill of information with armed robbery. LSA-R.S. 14:64. Following his arrest, he moved for a preliminary examination and bond reduction. He also asked that the victim be subpoenaed to testify at the hearing and that a subpoena duces tecum be issued to the victim for records of a particular bank transaction. At the hearing, when the State called its witness to testify, defendant’s attorney moved for sequestration of the witnesses and noted that he intended to call the victim as a witness. In response the court stated, “No, you’re not going to, Mr. Ridge. Not if I rule probable cause. That’s the end of it.” After hearing the testimony of the State’s only witness, the court found probable cause and denied defendant’s bond reduction request. Defendant presented no witnesses at the hearing.
Defendant filed an application with this court seeking a review of the trial court’s rulings. He assigned as error that the court denied him the right to call witnesses at the preliminary examination. In response to the application for supervisory writs, we denied that portion of the application which argued the bond reduction request should have been *10granted. We also stayed the trial in this ease and issued a writ of certiorari to review the claims made concerning the preliminary examination. We set the case for oral argument and ordered both sides to file a brief.
According to testimony presented by the investigating detective at the preliminary examination, just prior to 11:00 a.m. on May 30, 1992, Nan Simmons was robbed as she completed a transaction at an automated teller machine in Baton Rouge. Before entering the building, Simmons drove around to make sure nobody was nearby. When she did not see anybody, she went inside the building and proceeded to withdraw $50.00 from the machine. As she was taking the money from the machine, a man holding a knife demanded her money. He also told her to withdraw $500.00. When Simmons was unsuccessful, the man left, taking with him the $50.00 Simmons had just withdrawn and $1.00 from Simmons’ purse.
After the subject walked away, Simmons located an officer who was working as a security officer at a nearby shopping mall. The officer searched the area where the subject was last seen and found a man matching the description given by Simmons. Upon frisking the subject, the officer recovered a four-inch to six-inch steak knife which had been wrapped in a baseball cap. The officer also found $51.00 on the man in the same denominations specified by the victim. Simmons identified the man as being the person who had robbed her.
The issue before the court in this application is whether defendant should have been allowed to call the victim as a witness at the preliminary examination. In felony cases where an indictment has not been issued, a defendant has both a constitutional and a statutory right to a preliminary examination. La. Const, art. I, § 14; La.C.Cr.P. art. 292. The primary function of the examination is to ensure that probable cause exists to hold the accused in custody or under bond obligation. State v. Foster, 510 So.2d 717, 723 (La.App. 1st Cir.1987), vacated in part on other grounds, 519 So.2d 138 (La.1988). See also La.C.Cr.P. art. 296. While a preliminary examination can act as a discovery technique by the defense, the law does not treat it as such. State v. Mayberry, 457 So.2d 880, 882 (La.App. 3d Cir.), writ denied, 462 So.2d 191 (La.1984). See also Foster, 510 So.2d at 723. Although all of the procedural safeguards of a criminal jury trial need not be afforded at a preliminary examination, the defendant has a right to a hearing that ensures a fair and impartial determination of the issue of probable cause. The hearing is to be “full-blown and adversary” and one in which the defendant is entitled to confront witnesses against him and to fully cross-examine the witnesses. State v. Jenkins, 338 So.2d 276, 279 (La.1976). At the hearing, both the State and the defendant may produce witnesses, and the witnesses are subject to cross-examination. La.C.Cr.P. art. 294. See also Jenkins, 338 So.2d at 279; State in re Morrison, 406 So.2d 246, 248 (La.App. 1st Cir.1981), writ denied, 410 So.2d 1133 (La.1982). Inconsequential defects in the conduct of a preliminary examination will not mandate release of the accused or render the proceeding invalid. Jenkins, 338 So.2d at 279. Only those infor-malities or errors which substantially prejudice the defendant will result in a preliminary examination being held invalid. La. C.Cr.P. art. 298.
In State v. Herrin, 562 So.2d 1 (La.App. 1st Cir.), writ denied, 565 So.2d 942 (La.1990), this court indicated in dicta that a trial court errs when it refuses to allow the defendant to subpoena the victim to testify at a preliminary examination. The defendant in Herrin had been convicted of three counts of aggravated oral sexual battery. We found the court’s attempt to spare the child victims from the ordeal of testifying at the preliminary hearing to be laudable but incorrect. 562 So.2d at 10. Because the defendant in Herrin already had been convicted, we concluded the error was moot. We also noted the record did not reveal defendant had actually attempted to subpoena the victims.
In its opposition to the writ application, the State claims the preliminary examination was conducted properly. The State submits defendant did not actually call the victim as a witness and, therefore, he was not denied the right to present her as a witness. But defense counsel advised the court before testimony began that he had subpoenaed the *11alleged victim and intended to call her as a witness. The court unequivocally told counsel he was not going to call the victim if it found probable cause. Under these circumstances, it would have been foolhardy for counsel to persist in an attempt to call the vietim.
The court’s refusal to allow defendant to call the vietim as a witness ignores the language of Louisiana Code of Criminal Procedure article 294, which provides that “the defendant may produce witnesses [at the preliminary examination].” The court allowed the State to call its witness but did not allow defendant to call his witness. Thus, the court’s ruling affected the basic validity of the preliminary examination. See Jenkins, 338 So.2d at 279. Defendant’s writ is made peremptory, and the trial court is ordered to reopen the preliminary examination and to allow defendant to call witnesses in accordance with the views expressed herein. See Morrison, 406 So.2d at 248.
STAY ORDER RECALLED; WRIT MADE PEREMPTORY, AND CASE REMANDED FOR FURTHER PROCEEDINGS CONSISTENT WITH THE VIEWS EXPRESSED HEREIN.