Table of ContentsPreviousNext

Ispirer             Ispirer


Ispirer SQLWays Database Migration Software

Declaration of Local Variables with Composite Data Types

In this chapter describes declaration of local variable with composite (no scalar) data types. Scalar data type - is data type which hasn't internal components, such as numeric data types (NUMBER, DECIMAL, FLOAT,...), character data types (CHAR, VARCHAR2, RAW,...), datetime data types (DATE, TIMESTAMP,...) and boolean data type. Composite data type - is data type which has internal components, such as RECORD, TABLE and VARRAY.

Before declare variables with composite data type necessary define such data type.

TABLE 27. Declaration of Local Variables with Composite Data Types
Database
Statement
Description
Oracle
TYPE type_name IS RECORD ( 
{ 
 field_name field_type  
 [ 
  [NOT NULL]  
  := | DEFAULT        expression 
 ] 
 [,] 
}  
); 
Using this syntax, in Oracle defined RECORD type. Record is a group of related data items stored in fields, each with its own name and datatype. Field declaration is similar with local variable declaration.
RECORD type can contain objects, collections, and other records.
 
type_name - name of RECORD type.
field_name - field name in record.
field_type - field type in record.
 
Example: Next sample defined RECORD type R1 with fields a (number) and b (varchar2(10)):
 
TYPE R1 IS RECORD (
a NUMBER, b VARCHAR2(10) );
var_name type_name;
If type is RECORD data type, then Oracle declared record variable.
Microsoft SQL Server
Not supported
 


Table of ContentsPreviousNext
Ispirer             Ispirer
Copyright © 1999-2015 Ispirer Systems Ltd. Ispirer and SQLWays are trademarks of Ispirer Systems Ltd. All other product names may be trademarks of the respective companies. All rights reserved.