Example of check constraints - sql, PL-SQL Programming

Example of Check Constraints

Example: Workaround for when subqueries not permitted in CHECK constraints

CREATE FUNCTION NO_MORE_THAN_20000_ENROLMENTS ( )

RETURNS BOOLEAN;

RETURN (SELECT COUNT (*) FROM IS_ENROLLED_ON) <= 20000;

ALTER TABLE IS_ENROLLED_ON

ADD CONSTRAINT MAX_ENROLMENTS

CHECK (NO_MORE_THAN_20000_ENROLMENTS ( ));

Posted Date: 1/18/2013 7:17:46 AM | Location : United States







Related Discussions:- Example of check constraints - sql, Assignment Help, Ask Question on Example of check constraints - sql, Get Answer, Expert's Help, Example of check constraints - sql Discussions

Write discussion on Example of check constraints - sql
Your posts are moderated
Related Questions
Boolean Values Only the values TRUE, FALSE, & NULL can be assigned to a Boolean variable. For illustration, given the declaration DECLARE done BOOLEAN; the following statements

Advantages of Subprograms The Subprograms give extensibility; that is, tailor the PL/SQL language to suit your requirements. For illustration, if you require a procedure which

Example of WHEN or THEN Constraints A concrete example showing how SQL supports WHEN/THEN constraints CREATE TABLE SAL_HISTORY (EmpNo CHAR (6), Salary INTEGER NOT NULL,

Declaring Cursor Variables Once a REF CURSOR type is define by you, and then you can declare the cursor variables of that type in any PL/SQL block or subprogram. In the exampl

Case Sensitivity Similar to all the identifiers, the variables, the names of constants, and parameters are not case sensitive. For illustration, PL/SQL considers the following n

WHEN or THEN Key Constraints Suppose a table has two columns representing a period of time throughout which the information conveyed by the other columns is recorded as having

COSMOZOI C THEORY - Richter (1865) proposed the cosmozoic theory that says that life came by spores (cosmozoa) or other particles from other planets on the earth.

Declaring Objects: You can use the object types wherever built-in types like CHAR or NUMBER can be used. In the block below, you can declare object r of type Rational. Then, yo

In Packages The Forward declarations also group logically related subprograms in the package. The subprogram specifications go in the package specification, & the subprogram b

Packaging Cursors   You can split a cursor specification from its body for placement in a package. In that way, you can change the cursor body without changing the cursor spec