
102 Cal.App.3d 499 (1980)
162 Cal. Rptr. 411
In re GARY EADS on Habeas Corpus.
Docket No. 4689.
Court of Appeals of California, Fifth District.
February 22, 1980.
*500 COUNSEL
Morse & Morse and R. Neil Morse for Petitioner.
George Deukmejian, Attorney General, Robert H. Philibosian, Chief Assistant Attorney General, Arnold O. Overoye, Assistant Attorney General, James T. McNally and Diana Beth Constantino, Deputy Attorneys General, for Respondent.
OPINION
BROWN (G.A.), P.J.
Petitioner seeks a writ of habeas corpus directing that he be released from custody and directing the Superior Court *501 of Merced County to allow him to withdraw his plea of guilty to pending criminal charges.

FACTS
On October 12, 1979, an information was filed in the Merced County Superior Court charging petitioner with assault by means of force likely to produce great bodily injury in violation of Penal Code section 245, subdivision (a), and inflicting great bodily injury during the commission of the assault in violation of Penal Code section 12022.7.
On October 23, 1979, petitioner entered a conditional plea of guilty to the assault charge; the conditions were that the great bodily injury allegation be dismissed, the sentence be no greater than one year in county jail, and such sentence run concurrently with all misdemeanor cases pending against petitioner. The trial court tentatively accepted the conditional plea, stating it would make a final determination after reading the probation report.
On November 20, 1979, petitioner appeared for sentencing; the hearing was continued until November 21, 1979.
On November 21, 1979, the trial court ordered petitioner committed to the custody of the Department of Corrections for a diagnostic evaluation pursuant to Penal Code section 1203.03.

DISCUSSION
(1) Petitioner contends that Penal Code section 1203.03 does not authorize the order committing him for diagnostic evaluation because he was not convicted of an offense punishable by imprisonment in the state prison. We disagree.
A trial court's authority to order a criminal defendant committed to the custody of the Department of Corrections for a diagnostic evaluation pursuant to Penal Code section 1203.03 is limited by the express language of that statute  the defendant must be "... convicted of an offense punishable by imprisonment in the state prison...." Thus, the legality of petitioner's diagnostic commitment turns upon whether he stood convicted of an offense punishable by imprisonment in the state prison on November 21, 1979, the date of the diagnostic commitment.
*502 Penal Code section 1192.5[1] is determinative of the issue of whether petitioner was convicted of such an offense. Petitioner relies upon the second paragraph of Penal Code section 1192.5 to support his contention that he could not be sentenced to prison on November 21, 1979. The second paragraph of Penal Code section 1192.5 generally limits the trial court's sentencing power to that specified in the conditional plea. However, the second paragraph provides that this general rule applies, "... except as otherwise provided in this section...."
The third paragraph of Penal Code section 1192.5 is the only possible exception to the general rule stated in the second paragraph.[2] Although the third paragraph on its face provides for mandatory advisements to the defendant upon the court's approval of a conditional plea, the language of such advisements must be construed as substantive law; the second paragraph language which provides for an exception to the general rule therein stated can be given effect only if the third paragraph is *503 construed to state such an exception. If possible, we must construe Penal Code section 1192.5 to reconcile and give effect to all parts thereof. (See In re Bandmann (1958) 51 Cal.2d 388, 393 [333 P.2d 339].)
Construing the mandatory advisements stated in the third paragraph as substantive law, the trial court is thereby authorized to withdraw its prior approval of a conditional plea at the time set for pronouncement of judgment, and, if this is done, the defendant may withdraw his guilty plea if he so desires. Since the statute expressly requires the defendant to move to withdraw his plea if the court rejects the conditions at the time set for judgment, it follows that the guilty plea stands without conditions unless so withdrawn. Unless the third paragraph is so construed, an exception to the general rule stated in the second paragraph does not exist.
On November 21, 1979, the time set for pronouncement of judgment, the trial court had the power to sentence petitioner to prison by rejecting the conditions of his plea. Since the trial court was empowered to impose a prison sentence on November 21, 1979, petitioner stood convicted on that date of an offense punishable by imprisonment. Therefore, the diagnostic commitment was authorized by Penal Code section 1203.03.
However, a trial court has only conditional power to reject the plea conditions; the defendant's right to withdraw his guilty plea arises upon the exercise of such power. Our conclusion that the diagnostic commitment was lawful is grounded directly upon the trial court's conditional power to impose a prison sentence. We cannot properly rely upon a conditional power and ignore the condition; therefore, we shall give effect to the condition by holding that petitioner had the right to withdraw his guilty plea upon being committed for diagnostic evaluation.
We do not decide that a diagnostic commitment in and of itself is an exercise of the trial court's power to reject plea conditions. Upon our analysis, the conditional plea stands as such unless withdrawn by the defendant or subsequently rejected by the court. If a defendant exercises his right to withdraw the guilty plea upon being committed for diagnostic evaluation, the commitment obviously must be vacated for lack of a conviction to support it.[3]
*504 As respondent points out, a diagnostic evaluation may assist trial courts in deciding whether or not to accept a guilty plea conditioned upon a sentence to local custody. We have concluded that Penal Code section 1203.03 authorizes a diagnostic evaluation upon entry of such a conditional plea. However, we have also concluded that under Penal Code section 1192.5 it is the defendant's right to decide whether or not a diagnostic commitment is sufficiently onerous to withdraw his guilty plea and thereby relinquish the benefits of a plea bargain.
Petitioner has been in the custody of the Department of Corrections pursuant to the diagnostic commitment for several months. He may not at this point in time desire to withdraw his guilty plea. We will grant relief which allows petitioner to decide whether he presently desires to withdraw his guilty plea.[4]
Let a writ of habeas corpus issue directing the Superior Court of Merced County to grant Gary Eads' motion to withdraw the guilty plea entered on October 23, 1979, in action No. 9922 provided such a motion is filed within 20 days after this opinion becomes final in all courts.
Insofar as it seeks relief not granted above, the petition for writ of habeas corpus is denied.
Hopper, J., and Zenovich, J., concurred.
NOTES
[1]  On November 21, 1979, Penal Code section 1192.5 provided: "Upon a plea of guilty or nolo contendere to an accusatory pleading charging a felony, the plea may specify the punishment to the same extent as it may be specified by the jury on a plea of not guilty or fixed by the court on a plea of guilty, nolo contendere, or not guilty, and may specify the exercise by the court thereafter of other powers legally available to it.

"Where such plea is [conditionally] accepted by the prosecuting attorney in open court and is approved by the court, the defendant, except as otherwise provided in this section, cannot be sentenced on such plea to a punishment more severe than that specified in the plea and the court may not proceed as to such plea other than as specified in the plea.
"If the court approves of the [conditional] plea, it shall inform the defendant prior to the making of the plea that (1) its approval is not binding, (2) it may, at the time set for the hearing on the application for probation or pronouncement of judgment, withdraw its approval in the light of further consideration of the matter, and (3) in such case, the defendant shall be permitted to withdraw his plea if he desires to do so. The court shall also cause an inquiry to be made of the defendant to satisfy itself that the plea is freely and voluntarily made, and that there is a factual basis for such plea.
"If such [conditional] plea is not accepted by the prosecuting attorney and approved by the court, the plea shall be deemed withdrawn and the defendant may then enter such plea or pleas as would otherwise have been available.
"If such plea is withdrawn or deemed withdrawn, it may not be received in evidence in any criminal, civil, or special action or proceeding of any nature, including proceedings before agencies, commissions, boards, and tribunals." Effective January 1, 1980, section 1192.5 was amended to exclude from its scope pleas to specified crimes; the excluded crimes do not include violation of Penal Code section 245. The amendment did not change the language of the last four paragraphs of section 1192.5 which we construe herein.
[2]  The second and third paragraphs of Penal Code section 1192.5 address further proceedings after the court has initially approved the conditional plea. The fourth paragraph is not an exception to the second paragraph because it applies when the court initially rejects the conditional plea. (See People v. Johnson (1974) 10 Cal.3d 868, 872 [112 Cal. Rptr. 556, 519 P.2d 604].)
[3]  Although petitioner asserted that he had a right to withdraw his guilty plea on November 21, 1979, it does not appear that he actually moved to withdraw the plea on that date. Petitioner's contention to the contrary is not supported by the record.
[4]  We need not address petitioner's contention that the diagnostic commitment violated the local time condition of his plea because petitioner seeks only the right to withdraw his plea upon this ground.
