Professional Documents
Culture Documents
Composite data types: Composite data types also known as collections are of
following types
TABLE
RECORD
NESTED TABLE
VARRAYS
LOB data types: With the LOB data types you can store blocks of unstructured data
(such as text, graphic images, video clips) up to 4GB.
CLOB: The CLOB (Character Large Object) data type is used to store large
blocks of single byte character data in the database in line (inside the row) or out line
(outside the row).
BLOB: The BLOB (binary large object) data type is used to store binary large
objects data in the database in line (inside the row) or out line (outside the row).
BFILE: The BFILE (binary file) data type is used to store large binary objects
in operating system files outside the database.
NCLOB: The (National Character Large Object) data type is used to store large blocks of single
byte or fixed width multi-byte NCHAR Unicode data in the database in line (inside the row ) or
out line (outside the row) .
PL/SQL Statements
Statements in PL/SQL
The INTO clause must be used to store a table column value into a variable
declared in the DECLARATION section of PL/SQL block
SELECT ENAME INTO MEMNAME FROM EMP WHERE EMPNO=101176;
Operator:
An operator is used to manipulate individual data items and return a result. These items
are called operands or arguments. Operators are represented by special characters or
by keywords. For example, the multiplication operator is represented by an asterisk (*)
and the operator that tests for nulls is represented by the keywords IS NULL. The main
SQL operators are described below:
Unary and Binary Operators:
A unary operator operates on only one operand. A unary operator typically appears with
its operand in this format: operator operand
A binary operator operates on two operands. A binary operator appears with its
operands in this format: operand1 operator operand2
Precedence:
An important property of an operator is its precedence. Precedence is the order in which
Oracle evaluates different operators in the same expression. When evaluating an
expression containing multiple operators, Oracle evaluates operators with higher
precedence before evaluating those with lower precedence. Oracle evaluates operators
with equal precedence from left to right within an expression.
Arithmetic Operators:
You can use an arithmetic operator in an expression to negate, add, subtract, multiply,
and divide numeric values. The result of the operation is also a numeric value. Some of
these operators are also used in date arithmetic. Some examples of arithmetic
operators are:
+, -, *, / and so on.
Index-by tables
Index-by tables:
Also known as associative arrays. It lets you to look up elements using arbitrary
numbers and strings for subscript values.
Are similar to one-dimensional arrays and are referenced like arrays of records. Since
index-by tables can be passed as parameters, they can be used to move columns of
data into and out of database tables or between client-side applications and stored
subprograms.
Are composed of two components:
o Primary key of data type BINARY_INTEGER
o Column of scalar or record data type
Can increase in size dynamically because they are unconstrained
Nested Table
Nested tables hold an arbitrary number of elements. They use sequential numbers as
subscripts.
Within the database, nested tables can be considered one-column database tables.
Oracle does not store the rows of a nested table in any particular order. When the
nested table is retrieve into a PL/SQL variable, the rows are given consecutive
subscripts starting from one. That gives array-like access to individual rows.
Varrays
Items of type VARRAY are called varrays.
Allow to associate a single identifier with an entire collection.
Manipulate the collection as a whole and reference individual elements easily.
To reference an element, use standard subscripting syntax.