Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Class notes pl sql (sql01)

Rating
-
Sold
-
Pages
4
Uploaded on
25-03-2022
Written in
2013/2014

Lecture notes of 4 pages for the course pl sql at Kerala University (plsql variables)

Institution
Course

Content preview

PL/SQL - Variables
In this chapter, we will discuss Variables in Pl/SQL. A variable is nothing but a name
given to a storage area that our programs can manipulate. Each variable in PL/SQL
has a specific data type, which determines the size and the layout of the variable's
memory; the range of values that can be stored within that memory and the set of
operations that can be applied to the variable.
The name of a PL/SQL variable consists of a letter optionally followed by more
letters, numerals, dollar signs, underscores, and number signs and should not
exceed 30 characters. By default, variable names are not case-sensitive. You
cannot use a reserved PL/SQL keyword as a variable name.
PL/SQL programming language allows to define various types of variables, such as
date time data types, records, collections, etc. which we will cover in subsequent
chapters. For this chapter, let us study only basic variable types.

Variable Declaration in PL/SQL
PL/SQL variables must be declared in the declaration section or in a package as a
global variable. When you declare a variable, PL/SQL allocates memory for the
variable's value and the storage location is identified by the variable name.
The syntax for declaring a variable is −
variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT
initial_value]
Where, variable_name is a valid identifier in PL/SQL, datatype must be a valid
PL/SQL data type or any user defined data type which we already have discussed
in the last chapter. Some valid variable declarations along with their definition are
shown below −
sales number(10, 2);
pi CONSTANT double precision := 3.1415;
name varchar2(25);
address varchar2(100);
When you provide a size, scale or precision limit with the data type, it is called
a constrained declaration. Constrained declarations require less memory than
unconstrained declarations. For example −
sales number(10, 2);
name varchar2(25);
address varchar2(100);

Initializing Variables in PL/SQL
Whenever you declare a variable, PL/SQL assigns it a default value of NULL. If you
want to initialize a variable with a value other than the NULL value, you can do so
during the declaration, using either of the following −
 The DEFAULT keyword
 The assignment operator

Written for

Institution
Course

Document information

Uploaded on
March 25, 2022
Number of pages
4
Written in
2013/2014
Type
Class notes
Professor(s)
Fousia
Contains
All classes

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sreejipradeesh

Get to know the seller

Seller avatar
sreejipradeesh COLLEGE OF ENGINEERING, KOTTARAKKARA
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
4 year
Number of followers
1
Documents
24
Last sold
4 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions