Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

RECORD types and associative arrays, the user-defined types provided for use with stored procedures, make it possible to organize data into logical units for processing.

They can also be used as parameters or return values when stored procedures and functions call other stored procedures and functions.

Note however that values that have user-defined types cannot be passed to clients.

RECORD

RECORD is user-defined datatypes consisting a set of columns.

A user can process a variety of data respectively in a logical units.

As processing a variety of data including name, payroll, department in a single form of "employee", it can be handled as a single record type.

To declare a record datatype, A user need to refer to the contents in the DECLARE TYPE section.

Basic usages of the rest are the same as one in the DECLARE TYPE section except %ROWTYPE.TYPE type_name IS RECORD (col_name datatype , …);

ASSOCIATIVE ARRAY

ASSOCIATIVE ARRAY는 INTEGER 또는 VARCHAR를 배열 요소의 접근자로 사용하는 배열로 프로그래밍 언어의 해시 테이블과 유사하다.

An associative array, INTEGER OR VARCHAR data type is used as an identifier to access an element of an array, is similar to the hash table.

이를 이용하여 데이터의 개수와 상관없이 동일한 형식의 데이터들을 하나의 단위로 묶어 처리를 할 수 있다.

It can be used to combine data items of the same type into a single data item for processing, regardless of the amount of data.

예를 들어 사원들 중 사원번호 1~100까지의 사원 데이터를 처리하는 경우 100개의 데이터를 하나의 ASSOCIATIVE ARRAY 타입의 변수로 처리할 수 있다.

For instance, When processing "employees" data ranged from 1 to 100, An associative array can hold up to 100 data.

ASSOCIATIVE ARRAY의 선언은 DECLARE TYPE 섹션을 참고한다.

To declare an associative array, we recommend you to refer to the declare type section in a manual.

ASSOCIATIVE ARRAY 변수의 배열 요소 접근을 위해서는 다음과 같이 대괄호( [ ] )를 사용한다.

To access an array element, use a square branket as below.

예) V1[ 1 ] := 1; TYPE type_name IS TABLE OF datatype INDEX BY INTEGER|VARCHAR(size);

REF CURSOR(Cursor Variables)

A Cursor Variables are the variables for processing the dynamic SQL statements which retrieving multiple records.

This cursor variables is even more flexible than cursor(explicit cursor) since it is not subordinate to a certain SQL statement.

It can be passed as parameters between the stored procedures, and delivers value to the client.

It is different with explicit cursor in that a ref cursor refers to another statement even when cursor is open, but explicit cursor only refers to the same statement all the time.TYPE type_name IS REF CURSOR;

  • No labels