dbTalk Databases Forums  

Column NUMBERS accepting only a pre defined range of numbers

comp.databases.oracle.server comp.databases.oracle.server


Discuss Column NUMBERS accepting only a pre defined range of numbers in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Wilfrid
 
Posts: n/a

Default Column NUMBERS accepting only a pre defined range of numbers - 04-17-2011 , 07:22 AM






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)
)

Reply With Quote
  #2  
Old   
Michel Cadot
 
Posts: n/a

Default Re: Column NUMBERS accepting only a pre defined range of numbers - 04-17-2011 , 10:00 AM






"Wilfrid" <grille12 (AT) gmail (DOT) com> a écrit dans le message de news: 4daadb68$0$23678$426a34cc (AT) news (DOT) free.fr...
Quote:
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

Reply With Quote
  #3  
Old   
Wilfrid
 
Posts: n/a

Default Re: Column NUMBERS accepting only a pre defined range of numbers - 04-17-2011 , 10:38 AM



On 4/17/2011 5:00 PM, Michel Cadot wrote:
Quote:
"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.
I am all set.
thanks

Reply With Quote
  #4  
Old   
Marc Blum
 
Posts: n/a

Default Re: Column NUMBERS accepting only a pre defined range of numbers - 04-18-2011 , 02:28 AM



Quote:
CREATE TABLE orders
(
name VARCHAR2(20),
ID NUMBER(10) CHECK (ID BETWEEN 1 AND 750),
dateofrecord DATE)
constraint pk_ID (ID)
)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.