sql Column check constraint cannot reference other columns

I have a table like...

> myConstriants;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                                 NUMBER
 CODE                                               CHAR(3 CHAR)
 MIN_VALUE                                          NUMBER
 MAX_VALUE                                          NUMBER

and want to add a constraint like ...

alter table myConstriants
add constriant LAB3_EX2_CHK2
check (min_value < max_value);

but sql gives me...

ERROR at line 3: ORA-02438: Column check constraint cannot reference other columns

how do I check that the min_value is less that the max-value?

Answers


You've misspelled:

alter table myConstriants add constriant LAB3_EX2_CHK2 check (min_value < max_value);

alter table myConstriants
add CONSTRAINT LAB3_EX2_CHK2
check (min_value < max_value);

SqlFiddlDemo


Column must be not null (MIN_VALUE and MAX_VALUE)


Need Your Help

How do you disable Debug (Toolbar) for Ajax calls in Symfony2?

php ajax debugging symfony controller

Does anyone know how to disable the debug toolbar for Ajax calls?

numpy: apply operation to multidimensional array

python arrays numpy multidimensional-array

Assume I have a matrix of matrices, which is an order-4 tensor. What's the best way to apply the same operation to all the submatrices, similar to Map in Mathematica?