
528 P.2d 601 (1974)
Robert M. DeBolt, Appellant,
v.
Hoyt C. CUPP, Superintendent, Oregon State Penitentiary, Respondent.
Court of Appeals of Oregon.
Argued and Submitted September 17, 1974.
Decided November 25, 1974.
Review Denied January 28, 1975.
*602 John K. Hoover, Deputy Public Defender, Salem, argued the cause for appellant. With him on the brief was Gary D. Babcock, Public Defender, Salem.
Timothy Wood, Asst. Atty. Gen., Salem, argued the cause for respondent. With him on the brief were Lee Johnson, Atty. Gen., and W. Michael Gillette, Sol. Gen., Salem.
Before SCHWAB, C.J., and THORNTON and TANZER, JJ.
SCHWAB, Chief Judge.
In 1961 petitioner was convicted, upon his plea of guilty, of the crime of sodomy. Former ORS 167.040. By this post-conviction proceeding petitioner attacks various aspects of his conviction and life sentence imposed pursuant to former ORS 137.111.[1]*603 Petitioner stated four causes of action. The post-conviction court sustained a demurrer to two of them and, after an evidentiary hearing, ruled against petitioner on the other two. Petitioner appeals.

I
Petitioner's first cause of action is a constitutional assault on former ORS 137.111. The post-conviction court sustained a demurrer to this cause of action. Noting that petitioner failed to appeal his 1961 conviction at that time, the state argues this bars post-conviction consideration of petitioner's constitutional claim, citing Lerch v. Cupp, 9 Or. App. 508, 497 P.2d 379 (1972). The first question, thus, is jurisdictional.

A
Petitioner could have argued on appeal in 1961 that former ORS 137.111 was unconstitutional. The basis for such an appeal would have been ORS 138.050:
"A defendant who has plead guilty or no contest may take an appeal from a judgment on conviction where it imposes an excessive fine or excessive, cruel or unusual punishment * * *. On such appeal, the appellate court shall only consider the question whether an excessive fine or excessive, cruel or unusual punishment not proportionate to the offense has been imposed * * *."
In State v. Dixon, 238 Or. 121, 122-123, 393 P.2d 204 (1964), the court stated:
"After a plea of guilty, only the excessiveness or illegality of the sentence may be considered upon an appeal. ORS 138.050; State v. Jairl, 229 Or. 533, 541-542, 368 P.2d 323 (1962). A sentence may be excessive because it is beyond the maximum statutory penalty, or because it is `cruel or unusual.' State v. Montgomery, 237 Or. 593, 392 P.2d 642 (1964). A sentence may also be attacked at any time if the statute under which it is imposed is unconstitutional. In this appeal, the defendant alleges that the punishment is cruel or unusual, and that the statute under which it is imposed is unconstitutional."
It should be noted that the reference to an attack on a "statute under which" a sentence "is imposed" meant an attack on a specialized enhanced-penalty statute, not the statute defining the elements of the crime in question. See, Dixon v. Gladden, 250 Or. 580, 581, 444 P.2d 11, 12 (1968) (the earlier direct appeal raised the claim "that the statute providing for a life sentence for certain sex offenders was unconstitutional").[2]
Thus, in State v. Dixon, supra, the Supreme Court concluded that statutory authority to consider whether a sentence is "excessive," ORS 138.050, included authority to consider legal questions germane to the length of a sentence. A similar case is State v. Froembling, 237 Or. 616, 391 P.2d 390 (1964): in that direct appeal following a guilty plea the court considered the merits of a claim that defendant, upon being resentenced in the trial court, was entitled to credit for time served.
It follows that the contention petitioner makes in his first cause of action could have been made on direct appeal in 1961.
Lerch v. Cupp, supra, holds that claims that could have been made on direct appeal but were not because no appeal was taken generally are not cognizable in a subsequent post-conviction proceeding. *604 But this general rule is subject to exceptions; even in the absence of a direct appeal, claims that could have been raised on appeal have been resolved on their merits in post-conviction proceedings. Brooks v. Gladden, 226 Or. 191, 358 P.2d 1055 (1961); Endsley v. Cupp, 1 Or. App. 169, 459 P.2d 448 (1969), Sup.Ct. review denied (1970).
Under Oregon Supreme Court cases, legal questions that go to the duration as distinguished from existence of a sentence are such an exception. Such claims can be raised either on direct appeal as in Dixon and Froembling, or alternatively by way of post-conviction proceedings, and the failure to assert them in one manner is not a procedural bar to relief in the other manner. In Barnett v. Gladden, 237 Or. 76, 390 P.2d 614 (1964), the court considered on its merits the question of whether the statute providing for enhanced penalties for sex offenders was applicable to attempts to commit sex crimes. And in State v. Cloran, 233 Or. 400, 374 P.2d 748, 377 P.2d 911, 378 P.2d 961 (1963), although a direct appeal case, the court held that post-conviction proceedings are available to correct an invalid sentence when a prior felony relied upon in a habitual-criminal context was not a felony under Oregon law. The identical kind of claim has frequently been considered on direct appeal. State v. Bailleaux, Or. App., 98 Adv.Sh. 2126, 521 P.2d 1062, Sup.Ct. review denied (1974), and cases cited therein. See also, State ex rel. Gladden v. Kelly, 213 Or. 197, 324 P.2d 486 (1958).
All of the above cases involve legal questions relating to duration of a sentence. All of the cases have considered those questions on the merits, regardless of whether they were raised on direct appeal or in post-conviction proceedings. We conclude that such questions can be raised in either manner, and that this is an exception to the general rule of Lerch v. Cupp, supra.

B
Turning to the merits, the petition alleges:
"That there was no rational basis under former ORS 137.111 for singling out a class of individuals who have been convicted of certain sex offenses including sodomy under former ORS 167.040; that the arbitrary and capricious nature of former ORS 137.111 which allowed an individual to be given a life sentence for certain sex offenses if he is found to be a menace to society was invidious discrimination against petitioner and denied petitioner the equal protection and due process of law."
As refined on appeal, the gravamen of this broad contention seems to be that former ORS 137.111(2) is void for vagueness. That statute permitted imposing a life sentence on a sex offender found to have
"* * * a mental or emotional disturbance, deficiency or condition predisposing him to the commission of [certain sex crimes] * * * to a degree rendering the person a menace to the health or safety of others."
The state responds that petitioner's claims were resolved adversely to his position in State v. Dixon, supra. That may be. But we note that the only constitutional doctrines explicitly referred to in Dixon were right to a jury trial on the sentence question and cruel and unusual punishment.
Assuming petitioner's claims were not resolved sub silentio in Dixon, we reject them. Former ORS 137.111(2) is similar in wording and import to ORS 426.510 (1).[3] Faced with statutory definitions and classifications like those in former ORS 137.111(2) and in ORS 426.510(1), courts have consistently upheld them against vagueness and equal protection challenges. Annotation, 34 A.L.R.3d 652, 675-676, *605 681-684 (1970). We agree with the reasoning of the many cases cited in the annotation, and likewise uphold the statutory definition and classification.

II
Petitioner's second cause of action is a constitutional assault on former ORS 137.112 to 137.114, the statutes governing certain procedural aspects of sentencing under former ORS 137.111. Specifically, his petition alleges:
"That a life sentence under former ORS 137.111 is the functional equivalent of a mental commitment; that a mental commitment for persons who were not convicted of crimes could not be accomplished in Oregon without a hearing providing full procedural due process pursuant to the provisions of ORS 426.070 to 426.170; that the provisions of former ORS 137.112 to 137.114 did not provide the same procedural protections as the civil commitment statute including the right of compulsory process and notice of the nature of the proceedings; that there was no rational basis for the denial of these procedural rights and resulted in invidious discrimination against petitioner and denied petitioner the equal protection and due process of law."
The post-conviction court also sustained a demurrer to this cause of action.

A
Initially the same jurisdictional question is presented: Does petitioner's failure to make this claim on direct appeal in 1961 bar consideration of it at this time?
This is a closer question on which there is little authority. Frequently challenges to sentencing procedures present questions that cannot be resolved on the record, but instead require an evidentiary hearing. An example would be a claim of a "breached" plea bargain. Stewart v. Cupp, 12 Or. App. 167, 506 P.2d 503 (1973); cf., State v. Wickenheiser, 3 Or. App. 509, 475 P.2d 422 (1970). In such situations the claim cannot be resolved on appeal; it must be the subject of a post-conviction proceeding.
When, however, the procedural issue is a purely legal one, and the record is sufficient to raise it, should it be made on appeal or in a post-conviction proceeding? Reasoning by analogy to Dixon and the other cases discussed above, we assume but do not here decide that a legal issue about sentencing procedures can likewise be raised either on appeal or in a post-conviction proceeding.

B
On the merits petitioner's broader contention is that the normal due process procedural rights, that is, notice, opportunity to be heard, opportunity to present evidence, etc., are applicable to a sentencing hearing. Whether such procedures are constitutionally required is academic; they are required by statute.
ORS 137.020 requires the court to "appoint a time for" sentencing. ORS 137.030 provides that a felony "defendant shall be personally present" at sentencing. Taken together, these statutes obviously contemplate notice of the sentencing hearing to a defendant or his attorney.
Whenever "discretion is conferred upon the court as to the extent of punishment to be inflicted," the court may hear evidence "in aggravation or mitigation of the punishment." ORS 137.080. Such evidence can be "the testimony of witnesses examined in open court" or in other forms. ORS 137.090. If he chooses to do so, a defendant can testify at a sentencing hearing. ORS 137.100.
All of the above statutes were in effect when petitioner was sentenced in 1961. There is no reason to believe they were not applicable to his enhanced-penalty sentencing hearing. Petitioner does not claim he was denied the rights accorded by these statutes. There is simply no broad constitutional issue.
Petitioner's narrower contention is that the procedures created by former ORS 137.112 to 137.114 are different from the *606 procedures followed in mental commitment hearings, ORS ch. 426, and that this amounts to a denial of equal protection. Again, petitioner overlooks the additional, above-cited statutes governing sentencing hearing procedures. When all the statutes applicable to sentencing are contrasted with the statutes applicable to mental commitments, the differences are insignificant. Moreover, even if greater differences existed, this would not amount to a violation of the Equal Protection Clause. See, Williams v. New York, 337 U.S. 241, 69 S.Ct. 1079, 93 L.Ed. 1337 (1949); Annotation, 34 A.L.R.3d 652, 684-696 (1970).

III
Petitioner's third and fourth causes of action raised fact questions  that his guilty plea was not knowingly made and that he received ineffective assistance of counsel. Following an evidentiary hearing, the post-conviction court decided these factual claims against petitioner.
Resolution of petitioner's contentions presented a question of credibility: whether to believe petitioner or his former attorney. The post-conviction court chose to believe the latter, finding that:
"1. Petitioner was not formally advised in open court of the maximum penalty which he could receive as a result of his guilty plea, however, petitioner was in fact aware of the possible maximum penalty.
"2. Petitioner did not meet his burden of proof to show that he received ineffective assistance of counsel at trial.
"3. Furthermore, petitioner's testimony regarding his fourth cause of action was inconsistent in that petitioner claimed to be `stunned' by the life sentence imposed at the time of sentencing but later testified that he first learned of the provisions and effect of the enhanced penalty statute 10 years later and therefore, petitioner's testimony is inconsistent and appears to be designed to support his present contention."
The record supports these findings and we are bound by them. Ball v. Gladden, 250 Or. 485, 443 P.2d 621 (1968).
Affirmed.
THORNTON, Judge (specially concurring).
I concur in the result but am unable to agree in all respects with the analysis by which the prevailing opinion appears to conclude that petitioner could have raised the constitutionality of the sexually dangerous offender law on direct appeal in the 1961 proceeding after having pleaded guilty to the sodomy charge.
As I read ORS 138.050 and the prior decisions of this court,[1] it is my understanding that the only question which the appellate court is authorized to consider on direct appeal after a plea of guilty is "whether an excessive fine or excessive, cruel or unusual punishment not proportionate to the offense has been imposed." ORS 138.050.
If this is correct, then petitioner was entitled to raise the constitutionality question for the first time in the post-conviction court.
To me the statement quoted in the prevailing opinion from State v. Dixon, 238 Or. 121, 122-123, 393 P.2d 204, 205 (1964), viz., "* * * A sentence may also be attacked at any time if the statute under which it is imposed is unconstitutional * * *," even on direct appeal after a plea of guilty, is in conflict with the express provisions of ORS 138.050.
NOTES
[1]  the presentence hearing and upon the consideration of the psychiatric report required * * * the court may, in its discretion * * * sentence any person convicted under * * * ORS 167.040 * * * to an indeterminate term not exceeding the natural life of such person if:
"(1) The offense involved a child under the age of 16 years; and
"(2) The court finds that such person has a mental or emotional disturbance, deficiency or condition predisposing him to the commission of any crime punishable under ORS * * * 167.040 * * * to a degree rendering the person a menace to the health or safety of others." Former ORS 137.111.
[2]  Many cases, e.g., State v. Kabachenko, 2 Or. App. 202, 465 P.2d 891, Sup.Ct. review denied (1970), hold that on direct appeal following a guilty plea it is not possible to contest constitutionality of the substantive statute defining the elements of the crime involved.
[3]  ORS 426.510(1) provides:

"`Sexually dangerous person' means one, not insane who by a course of repeated misconduct in sexual matters has evidenced such lack of power to control his sexual impulses as to be dangerous to other persons of the age of 12 or under because he is likely to attack or otherwise inflict injury or pain on the objects of his desire."
[1]  State v. Middleton, 2 Or. App. 70, 465 P.2d 913 (1970); State v. Kabachenko, 2 Or. App. 202, 465 P.2d 891, Sup.Ct. review denied (1970); State v. Lammon, 2 Or. App. 205, 465 P.2d 490, Sup.Ct. review denied (1970); State v. Brudos, 3 Or. App. 239, 471 P.2d 861, Sup.Ct. review denied (1970); State v. Gardner, 3 Or. App. 486, 475 P.2d 92 (1970); State v. Wickenheiser, 3 Or. App. 509, 475 P.2d 422 (1970); and State v. Slopak, 3 Or. App. 532, 475 P.2d 421 (1970).
