Constants and variables in pl sql, PL-SQL Programming

Constants and Variables:

 You can declare the constants and variables in the declarative section of any PL/SQL subprogram, block, or package. The Declarations allot the storage space for a value that specify its datatype, and name the storage space location so that you can reference it. The Declarations can also assign an initial value and enforce the NOT NULL constraint.

1070_constant variable.png

Keyword and Parameter Description:


These identify the program constant.


These keywords indicate the declaration of a constant. You should initialize a constant in its declaration. The value of a constant cannot be changed if once it is initialized.


These identify the field in a user-defined or %ROWTYPE record formerly declared within the present scope.


These identify a predefined scalar datatype like the BOOLEAN, NUMBER, or VARCHAR2.


These identify a database table and column that should be available when the declaration is elaborated.


These identify the program variable.


These identify the nested table, index-by table, or varray earlier declared within the present scope.


These identify an explicit cursor formerly declared within the present scope.


These identify a PL/SQL cursor variable formerly declared within the present scope.


These identify an object (or instance of the object type) formerly declared within the present scope.


These identify a user-defined record formerly declared within the present scope.


These identify a database table (or view) that should be available when the declaration is elaborated.


This attribute gives a record type that presents a row in the database table or a row fetched from a formerly declared cursor. The Fields in the record and corresponding columns in the row have similar names and datatypes.


This attribute gives the datatype of a formerly declared collection, field, cursor variable, object, record, database column, or variable.


These constraints prevent the assigning of the nulls to a variable or constant. At run time, trying to assign the null to a variable defined as NOT NULL raises the predefined exception VALUE_ERROR. The constraint NOT NULL should be followed by an initialization clause.


This is a randomly complex combination of the variables, literals, constants, operators, and function calls. The easiest expression consists of a single variable. If the declaration is elaborated, the value of the expression is assigned to the constant or variable. The value and the constant or variable should have compatible datatypes.

Posted Date: 10/6/2012 9:10:04 AM | Location : United States

Related Discussions:- Constants and variables in pl sql, Assignment Help, Ask Question on Constants and variables in pl sql, Get Answer, Expert's Help, Constants and variables in pl sql Discussions

Write discussion on Constants and variables in pl sql
Your posts are moderated
Related Questions
The accuracy of product table data is critical and the Brwebean's. owner wants to have an audit file that contains information regarding all DML activity on the BB_PRODUCT table. T

CLOSE Statement The CLOSE statement allows the resources held by a cursor variable or open cursor to be reused. No more rows can be fetched from the cursor variable or closed

Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Using %ROWTYPE The %ROWTYPE attribute gives a record type which represents a row in a table (or view). The record can store the whole row of data selected from the table or fetc

Data Types in SQL - Decimal DECIMAL, NUMERIC, REAL, FLOAT and various other terms for various sets of rational numbers. When these key words are specified for the declared typ

1. Create a procedure called TAX_COST_SP to accomplish the tax calculation task. Keep in mind that the state and subtotal values are inputs into the procedure and the procedure is

Albeit simple method : These all the truth tables give us our first as albeit simple method for proving a theorem: where check whether it can be written in propositional logic

Structure of an Object Type: Similar to package, an object type has 2 parts: the specification and the body. The specification is the interface to your applications; it declar

Renaming Columns - SQL SQL has no direct counterpart of RENAME. To derive the table on the right in Figure 4.4 from the table on the left, Tutorial D has IS_CALLED RENAME ( St

Example of WRAP Operator - SQL The effect of Example can be obtained in SQL but note that one needs to write down not only the names of the columns being wrapped but also the