Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Alphabetical
If you want to check for ONLY A-z ('Abc' is valid but 'Abc1' is not)
then this check should work for you:
CHECK(TRANSLATE(TRANSLATE(UPPER(mcf_custnum),'AABCDEFGHIJKLMNOPGRSTUVWXYZ','A'),'~A','~')
IS NULL)
If you want to check that the column contains at least one character of
A-z ('1Abc1' is valid but '123' is not) then try this one:
CHECK(TRANSLATE(UPPER(mcf_custnum),'~ABCDEFGHIJKLMNOPGRSTUVWXYZ','~')||'
' <> UPPER(mcf_custnum)||' ' )
jmclaugh_at_cscc.edu wrote:
>
> Ok here's a gooden.
>
> I am creating a table with this column and check in it:
>
> mcf_custnum char(25) CHECK(mcf_custnum BETWEEN 'A' AND 'z'),
>
> I am trying to check the whole string to see if it has capital or
> lowercase a thru z. If it doesn't, the record isn't allowed in the table.
> I am sorry if I sound like a newby, but I am and this is really
> frustrating. Using Oracle 7.X. The above piece of code will only check
> the first character and ignore the rest.
>
> Joel McLaughlin
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
Received on Sun Aug 10 1997 - 00:00:00 CDT
![]() |
![]() |