Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Integrity Constraint
Ceri <cerit_at_teleordnospamplease.co.uk>ÀÌ(°¡) ¾Æ·¡ ¸Þ½ÃÁö¸¦
news:8E8AA8F3Dcerittownsend_at_172.17.8.4¿¡ °Ô½ÃÇÏ¿´½À´Ï´Ù.
> Hi,
>
> I need to check that a valid entry is being made to a field in a table.
> I am running Oracle 8.0.4
>
> The field is a varchar2(11) and the data should be exactly 10 characters
> long, the first 9 being numeric and the last character may be numeric or a
> character.
> Unfortunately, checking this at the client application is not an option.
> The checking needs to be done by the database.
>
> Could anyone give me an idea of how to achieve this please.
>
> TIA
> Ceri
> --
> *- Ceri -*
> ** The views expressed here are entirely my own. **
> To reply by e-mail, remove nospamplease from address.
IMHO,
Create table tunnel
(lkr varchar2(11),
constraint tunnel_lkr_ck CHECK((to_number(substr(lkr,1,9)) >= 100000000) and
(substr(lkr,-1) in ('a','b','c',
...,'z','A','B','C',...,'0','1','2',...,'9')));
Like above.
Would you send me a email when you success your job with my ex.?
Received on Fri Nov 26 1999 - 12:43:01 CST
![]() |
![]() |