Oracle7 Server SQL Reference

Contents Index Home Previous Next

TYPE (Embedded SQL)

Purpose

To perform user-defined type equivalencing, or to assign an Oracle7 external datatype to a whole class of host variables by equivalencing the external datatype to a user-defined datatype.

Prerequisites

The user-defined datatype must be previously declared in an embedded SQL program.

Syntax

Keywords and Parameters

type

is the user-defined datatype to be equivalenced with an Oracle7 external datatype.

datatype

is an Oracle7 external datatype recognized by the Oracle Precompilers (not an Oracle7 internal datatype). The datatype may include a length, precision, or scale. This external datatype is equivalenced to the user-defined type and assigned to all host variables assigned the type. For a list of external datatypes, see Programmer's Guide to the Oracle Precompilers.

Usage Notes

User defined type equivalencing is one kind of datatype equivalencing. You can only perform user-defined type equivalencing with the embedded SQL TYPE command in a Pro*C or Pro*Pascal Precompiler program. You may want to use datatype equivalencing for one of the following purposes:

For more information on using the TYPE command to perform user-defined type equivalencing, see Programmer's Guide to the Oracle Precompilers.

All Oracle Precompilers also support the embedded SQL VAR command for host variable equivalencing.

Example I

This example shows an embedded SQL TYPE statement in a Pro*C Precompiler program:

struct screen {short len; 
		   char  buff[4002];
               }; 
typedef struct screen graphics; 

EXEC SQL BEGIN DECLARE SECTION; 
	EXEC SQL TYPE graphics IS VARRAW (4002); 
	graphics crt;  -- host variable of type graphics 
	... 
EXEC SQL END DECLARE SECTION; 

Example II

This example shows an embedded SQL TYPE statement in a Pro*Pascal Precompiler program:

Type 
	OraDate = Record 
		    Cent, Year, Month, Day, Hour, Min, Sec: Byte                 End; 

Var 
	EXEC SQL BEGIN DECLARE SECTION; 
	  EXEC SQL TYPE OraDate IS DATE; 
	  Birthday: OraDate;  -- host variable of type OraDate 
	  ... 
	EXEC SQL END DECLARE SECTION; 

Related Topics

VAR command (Embedded SQL) [*]


Contents Index Home Previous Next