A Appendix A

This appendix includes the following:

Oracle Data Types

The following are code for Oracle data types.

Table A-1 Oracle Data Type Codes

Oracle Data Type Codes

ORATYPE_VARCHAR2

1

ORATYPE_NUMBER

2

ORATYPE_SINT

3

ORATYPE_FLOAT

4

ORATYPE_STRING

5

ORATYPE_DECIMAL

7

ORATYPE_LONG

8

ORATYPE_VARCHAR

9

ORATYPE_DATE

12

ORATYPE_REAL

21

ORATYPE_DOUBLE

22

ORATYPE_UNSIGNED8

23

ORATYPE_RAW

23

ORATYPE_LONGRAW

24

ORATYPE_UNSIGNED16

25

ORATYPE_UNSIGNED32

26

ORATYPE_SIGNED8

27

ORATYPE_SIGNED16

28

ORATYPE_SIGNED32

29

ORATYPE_PTR

32

ORATYPE_OPAQUE

58

ORATYPE_UINT

68

ORATYPE_CHAR

96

ORATYPE_CHARZ

97

ORATYPE_BFLOAT

100

ORATYPE_BDOUBLE

101

ORATYPE_CURSOR

102

ORATYPE_ROWID

104

ORATYPE_MLSLABEL

105

ORATYPE_OBJECT

108

ORATYPE_REF

110

ORATYPE_CLOB

112

ORATYPE_BLOB

113

ORATYPE_BFILE

114

ORATYPE_CFILE

115

ORATYPE_RSLT

116

ORATYPE_NAMEDCOLLECTION

122

ORATYPE_COLL

122

ORATYPE_TIMESTAMP

187

ORATYPE_TIMESTAMPTZ

188

ORATYPE_INTERVALYM

189

ORATYPE_INTERVALDS

190

ORATYPE_SYSFIRST

228

ORATYPE_TIMESTAMPLTZ

232

ORATYPE_SYSLAST

235

ORATYPE_OCTET

245

ORATYPE_SMALLINT

246

ORATYPE_VARRAY

247

ORATYPE_TABLE

248

ORATYPE_OTMLAST

320

ORATYPE_RAW_BIN

2000


These codes are also listed in the oraconst.txt file located in the ORACLE_BASE\\ORACLE_HOME\oo4o directory.

Additional Schemas

Occasionally other schemas are required to run examples. These schemas are listed in the following sections.

Schema Objects Used in OraMetaData Examples

This section presents OraMetaData schema definitions.

CREATE TYPE ORAMD_ADDRESS AS OBJECT ( no NUMBER, 
                   street VARCHAR(60), 
                   state CHAR(2), 
                   zip CHAR(10), 
MEMBER PROCEDURE ChangeStreetName(newstreet IN VARCHAR2) 
); 

Schema Objects Used in LOB Data Type Examples

The following schema objects are used in the OraLOB and BFILE examples. Run the SQL script ORAEXAMP.SQL on your database to set up the schema.

CREATE TABLE part ( 
                   part_id NUMBER, 
                   part_name VARCHAR2(20), 
                   part_image BLOB, 
                   part_desc CLOB, 
                   part_collateral BFILE 
); 
 
Create Directory NewDirectoryName as 'C:\valid\path' 

Schema Objects Used in the OraObject and OraRef Examples

The following schema objects are used in the OraObject and OraRef examples. Data for the following tables can be inserted with the ORAEXAMP.SQL script that is provided with the OO4O installation.

CREATE TYPE address AS OBJECT (
                        street VARCHAR2(200),
                        city VARCHAR2(200),
                        state CHAR(2),
                        zip VARCHAR2(20)
);
 
CREATE TYPE person as OBJECT( 
                        name VARCHAR2(20), 
                        age NUMBER,
                        addr ADDRESS);
 
CREATE TABLE person_tab of PERSON;
CREATE TABLE customers(
                        account NUMBER,
                        aperson REF PERSON);

Schema Objects Used in OraCollection Examples

The following schema is used in examples of OraCollection methods

CREATE TYPE ENAMELIST AS VARRAY(20) OF VARCHAR2(30);
  CREATE TABLE department (
    dept_id NUMBER(2),
    name VARCHAR2(15),
    ENAMES ENAMELIST);

    DROP TYPE COURSE;

  CREATE TYPE Course AS OBJECT (
    course_no NUMBER(4), 
    title VARCHAR2(35),
    credits NUMBER(1));

  CREATE TYPE CourseList AS TABLE OF Course;

  CREATE TABLE division (
    name VARCHAR2(20),
    director VARCHAR2(20),
    office VARCHAR2(20),
    courses CourseList) 
  NESTED TABLE courses STORE AS courses_tab;