![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I have a table such as below. Is there a way to limit the range of number so it does not exceed a predefined maximum limit? For instance the maximum range for the ID column would 750 and if there is an attemps to insert or update a record that contain a column with 845, it will return an error. Thanks in advance for your help. Wilfrid CREATE TABLE orders ( name VARCHAR2(20), ID NUMBER(10), dateofrecord DATE) constraint pk_ID (ID) ) |
#3
| |||
| |||
|
|
"Wilfrid"<grille12 (AT) gmail (DOT) com> a écrit dans le message de news: 4daadb68$0$23678$426a34cc (AT) news (DOT) free.fr... | Hello, | | I have a table such as below. Is there a way to limit the range of | number so it does not exceed a predefined maximum limit? | For instance the maximum range for the ID column would 750 and if there | is an attemps to insert or update a record that contain a column with | 845, it will return an error. | | Thanks in advance for your help. | Wilfrid | | | CREATE TABLE orders | ( | name VARCHAR2(20), | ID NUMBER(10), | dateofrecord DATE) | constraint pk_ID (ID) | ) | Have a look at constraint: http://download.oracle.com/docs/cd/B...2.htm#g1053592 Regards Michel I did not know that. |
#4
| |||
| |||
|
|
CREATE TABLE orders ( name VARCHAR2(20), ID NUMBER(10) CHECK (ID BETWEEN 1 AND 750), dateofrecord DATE) constraint pk_ID (ID) ) |
![]() |
| Thread Tools | |
| Display Modes | |
| |