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
3
Uploaded on
25-03-2022
Written in
2013/2014

Lecture notes of 3 pages for the course pl sql at Kerala University (plsql arrays)

Institution
Course

Content preview

PL/SQL - Arrays
In this chapter, we will discuss arrays in PL/SQL. The PL/SQL programming
language provides a data structure called the VARRAY, which can store a fixed-
size sequential collection of elements of the same type. A varray is used to store an
ordered collection of data, however it is often better to think of an array as a
collection of variables of the same type.
All varrays consist of contiguous memory locations. The lowest address
corresponds to the first element and the highest address to the last element.




An array is a part of collection type data and it stands for variable-size arrays. We
will study other collection types in a later chapter 'PL/SQL Collections'.
Each element in a varray has an index associated with it. It also has a maximum
size that can be changed dynamically.

Creating a Varray Type
A varray type is created with the CREATE TYPE statement. You must specify the
maximum size and the type of elements stored in the varray.
The basic syntax for creating a VARRAY type at the schema level is −
CREATE OR REPLACE TYPE varray_type_name IS VARRAY(n) of
<element_type>
Where,

 varray_type_name is a valid attribute name,
 n is the number of elements (maximum) in the varray,
 element_type is the data type of the elements of the array.
Maximum size of a varray can be changed using the ALTER TYPE statement.
For example,
CREATE Or REPLACE TYPE namearray AS VARRAY(3) OF VARCHAR2(10);
/

Type created.
The basic syntax for creating a VARRAY type within a PL/SQL block is −
TYPE varray_type_name IS VARRAY(n) of <element_type>
For example −
TYPE namearray IS VARRAY(5) OF VARCHAR2(10);
Type grades IS VARRAY(5) OF INTEGER;

Written for

Institution
Course

Document information

Uploaded on
March 25, 2022
Number of pages
3
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