Difference between revisions of "RANGE Column Constraint"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
=RANGE=
 
 
 
==Class==
 
Column Constraints
 
 
 
 
==Purpose==
 
==Purpose==
 
Column constraint to specify minimum and maximum values for a date or numerical column
 
Column constraint to specify minimum and maximum values for a date or numerical column
Line 26: Line 19:
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
set sql to recital
+
CREATE TABLE orderhead;
CREATE TABLE orderhead (ord_week INT RANGE 1,52 ,
+
  (ord_week INT RANGE 1,52,;
ord_date DATE RANGE date(),gomonth(date(),12));
+
  ord_date DATE RANGE date(), gomonth(date(),12))
 
</code>
 
</code>
  
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]

Latest revision as of 11:36, 22 December 2009

Purpose

Column constraint to specify minimum and maximum values for a date or numerical column


Syntax

RANGE <expr1>,<expr2>


See Also

ALTER TABLE, CONSTRAINTS, CREATE TABLE


Description

A constraint is used to define rules that help to provide data integrity. Column constraints are specific to the column name specified. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.

The RANGE column constraint is used to specify minimum and maximum values for a date or numerical column. The minimum value is specified in <expr1>, the maximum in <expr2>. Attempting to update the column with a value outside this range generates an error.


Example

CREATE TABLE orderhead;
  (ord_week INT RANGE 1,52,;
  ord_date DATE RANGE date(), gomonth(date(),12))


Products

Recital, Recital Server