HELP-STUPID QUESTION [message #365924] |
Mon, 27 March 2000 01:23  |
BA
Messages: 2 Registered: March 2000
|
Junior Member |
|
|
I'm new to the world of Oracle, and I cannot find the "how-to" for this anywhere! It's likely a stupid question for you. Here goes:
I'm creating a table & I want to add a check clause so that the user will be able to enter the value (JR, SR) in either uppercase or lowercase, or a combination of both. I think it has something to do with A-Z, a-z but I've tried diff't combos & can't get it to work.
HELP!! and Thanks!!!
|
|
|
Re: HELP-STUPID QUESTION [message #365925 is a reply to message #365924] |
Mon, 27 March 2000 08:43   |
Thierry Van der Auwera
Messages: 44 Registered: January 2000
|
Member |
|
|
Hallo BA,
Just add a constraint to your table.
Example
your table : TAB_A
the field : tab_a_field1
the constraint : tab_a_const1
ALTER TABLE tab_a ADD CONSTRAINT tab_a_const1 CHECK (UPPER(tab_a_field1) IN ('JR','SR'));
Hope this is what you are looking for.
Greetings,
Thierry.
|
|
|
Re: HELP-STUPID QUESTION [message #365927 is a reply to message #365924] |
Mon, 27 March 2000 13:02  |
BA
Messages: 2 Registered: March 2000
|
Junior Member |
|
|
Thierry, Thanks for your help... I still can't get it to work though. (I'm creating the table now.) As a test, without the other columns, I'm doing this:
create table test (
level char(2) CHECK (UPPER(level) IN('JR','SR')));
...and it gives me an error "invalid column name". Do you know what the problem is? I didn't think I needed to necessarily ADD CONSTRAINT, but do I??
Thanks again!
|
|
|