I am making a table PATIENT which looks something like following:
CREATE TABLE PATIENT
(
PATIENT_ID integer NOT NULL auto_increment,
PATIENT_CONTROL_NO char(10) NOT NULL,
MEDICAL_RECORD_NO char(10) NOT NULL,
PERSON_ID integer NOT NULL,
GUARANTOR_ID integer NOT NULL,
GUARANTOR_REL_CODE char(2) NOT NULL,
TREAT_AUTH_CODE char(18) NULL,
ADC_CODE char(2) NULL,
CAPPLAN_AMTMONTH decimal(11,2) NULL,
PRIMARY KEY (PATIENT_ID,PATIENT_CONTROL_NO,MEDICAL_RECORD_NO),
check(GUARANTOR_REL_CODE in('01','18','19','20','21','39','40','53','G8'))
);
Now the thing is I want to add the following Constraint(character-wise) in the column "TREAT_AUTH_CODE" which has 18 characters:
CHARACTER_POSITION CHARACTER_TYPE
1,2,5,6,9,10 NUMBERS
3,4,7,8,11-18 ALPHABETS
Do I have to use the concept of arrays or can it be achieved in some easier way? If arrays, help with that too....
Thankx.....