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
UPDATE Statement   The UPDATE statement transforms the values of the specified columns in one or more rows in the table or view. Syntax:

EXECUTE IMMEDIATE Statement   The EXECUTE IMMEDIATE statement prepare (parses) and instantly executes a dynamic SQL statement or an anonymous PL/SQL block. Syntax:

Definition of FROM - SQL Recall that the operand of FROM is denoted by a commalist, each element of that commalist being a table expression optionally accompanied by a range v

Using Aliases The Select-list items fetched from a cursor related with the %ROWTYPE should have simple names or, if they are expressions, should have aliases. In the example bel

Parameter & Keyword Description: function_name: The user-defined function is identifying by that keyword. parameter_name: This identifies the formal parameter that

Logical Operators The logical operators AND, NOT, and OR follow the tri-state logic shown in table below. The AND and OR are binary operators; NOT is a unary operator.

Use Native Dynamic SQL A few programs (a normal-purpose report writer for illustration) should build and process a variety of SQL statements at run time. Therefore, their full

Redeclaring Predefined Exceptions Keep in mind that, the PL/SQL declares predefined exceptions globally in the package STANDARD; Therefore you need not declare them yourself.

Using the Collection Methods The collection methods below help to generalize the code and make collections easier to use and also make your applications easier to maintain:

Advantages of Packages The benefits of the Packages are as shown below: Modularity The Packages encapsulate logically associated items, types, and subprograms in the