开发者

What does the below comparison means?

Could any one explain why NOVALIDATE is written their and why alpha betwnn two ":" and "[]"

ALTER TABLE CUSTOMERS
ADD CONSTRAINT cust_f_name
CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha:]]'))NOVALIDATE ;

an开发者_Go百科d what does

REGEXP_LIKE(cust_first_name,'^[0-9]') 

and

REGEXP_LIKE(cust_first_name,'^A-Z')

means ? is that numbers not allowed?


These are regular expressions, used in Oracle as a table constraint.

  • [:alpha:] matches any character from the alpha POSIX class; that is, alphabetic characters (a-z and A-Z).
  • The ^, in the context of ^[0-9], means look from the beginning of the string. [0-9] is the class of numbers (i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9)
  • ^A-Z means negate the class A-Z; so it would match anything that didn't contain an upper case alphabetic character.

NOVALIDATE means that, once the constraint is added to the table CUSTOMERS, Oracle will not check that any current entries violate the constraint and only apply it to newly inserted records.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜