0

How do I create a constraint that expects the string to start with a capital letter followed by lower case letters, e.g Peter

I know how to do full uppercase

NAME        VARCHAR2 (12)   CONSTRAINT NAME_chk CHECK name = UPPER (name)
Martin Smith
  • 438,706
  • 87
  • 741
  • 845
Maestro
  • 71
  • 1
  • 11

1 Answers1

1

The answer i've worked out is to use the Initcap function

So

FNAME            VARCHAR2 (15) CONSTRAINT Name_ck CHECK (fname=initcap (fname))
Maestro
  • 71
  • 1
  • 11
  • but why? handle casing application side rather than database side otherwise you might cause yourself some major headaches later on – Takarii Jul 19 '16 at 12:50