Difference between revisions of "RANGE Column Constraint"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
 
Line 19: 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>
  

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