Using not null-declarations in sql, PL-SQL Programming

Using NOT NULL

Besides assigning an initial value, the declarations can impose the NOT NULL constraint, as the example below shows:

acct_id INTEGER(4) NOT NULL := 9999;

You cannot assign nulls to the variable define as NOT NULL. If you attempt the PL/SQL raises predefined exception VALUE_ERROR. The NOT NULL constraint should be followed by the initialization clause. For e.g. the declaration below is illegal:

acct_id INTEGER(5) NOT NULL; -- illegal; not initialized

Remember that the subtypes NATURALN and POSITIVEN are predefined as NOT NULL. For illustration, the declarations below are equivalent:

emp_count NATURAL NOT NULL := 0;
emp_count NATURALN := 0;

In the NATURALN and POSITIVEN declarations, the type specifier should be followed by an initialization clause. Or else, you get a compilation error. For e.g. the declaration below is illegal:

line_items POSITIVEN; -- illegal; not initialized

Posted Date: 10/3/2012 4:42:43 AM | Location : United States







Related Discussions:- Using not null-declarations in sql, Assignment Help, Ask Question on Using not null-declarations in sql, Get Answer, Expert's Help, Using not null-declarations in sql Discussions

Write discussion on Using not null-declarations in sql
Your posts are moderated
Related Questions
Using raise_application_error The Package DBMS_STANDARD that is supplied with Oracle gives language facilities that help your application to interact with Oracle. For illustra

Type versus Representation Confusion in SQL This describes how a value might have two or more distinct representations. For example, user-defined type POINT might have a decla

Bitmap Join Indexes - This feature will increase the performance and detains the size and format of your databases in data Character Semantics and Globalization -This featur

Third Step at defining type SID in SQL CREATE DOMAIN SID AS VARCHAR(5) CHECK ( VALUE IS NOT NULL AND SUBSTRING(VALUE FROM 1 FOR 1) = 'S' AND CAST('+'||SUBSTRING(VALUE

Parameter SELF in pl/sql The MEMBER methods recognize a built-in parameter named SELF that is an instance of the object type. Whether declared explicitly or implicitly, it is

SQL Functions The PL/SQL uses all the SQL functions involving the following aggregate functions that summarize the whole columns of the Oracle data: GROUPING, AVG, COUNT, STDDE

Using Aggregation on Nested Tables Example is the most direct translation of its counterpart in the theory book that can be obtained in SQL but it is so over-elaborate that no

Defining REF CURSOR Types To make cursor variables, you take 2 steps. At first, you define a REF CURSOR type, and then declare the cursor variables of that type. You can defin

Updating a Variable Assignment of an attribute value in a variable of a structured type Synatx: SET SN.C = 'S2'; As in Example the entire statement is equivalent to a

Using Operator DEREF: You cannot navigate through refs within the PL/SQL procedural statements. Rather than, you should use the operator DEREF in the SQL statement. The DEREF