문제

I have a column NAME
It must contain only characters and not numbers
How do I use CHECK condition:

CHECK(NAME NOT LIKE '%[0-9]%')

or any other method...

edit: Oracle database is used.

도움이 되었습니까?

해결책

You didn't state your DBMS so I'm assuming PostgreSQL

CHECK(name ~ '^[^0-9]*$')

다른 팁

Double negative Should be standard (not MySQL though) because it uses LIKE:

CHECK(NAME NOT LIKE '%[^a-zA-Z]%')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top