O'Reilly logo

Java Programming with Oracle JDBC by Donald Bales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Relational Database Design

At this point, we have a theoretical analysis of the HR database. Before we create a physical implementation, we need to consider how it will be implemented. This is the step in which we decide which data types we will use for the attributes, determine how to constrain those data types, and define external primary keys, among other things. Let’s start by deciding which data types to use.

Selecting Data Types

One of the beautiful things about Oracle is that it does not have presentation data types. There is no money type, for example. Not having presentation data types keeps things simple. The number of data types you need to work with is kept to a bare minimum. With Oracle, you get a small number of data types that allow you to work with the following four basic types of data:

  • Binary

  • Character

  • Date

  • Numeric

For binary data, you have the following Oracle data types to work with:

RAW

A varying-length binary type that can hold up to 2 KB

LONG RAW

A varying-length binary type that can hold up to 2 GB

BLOB

A varying-length binary type that can hold up to 4 GB

BFILE

An external file that can hold up to 4 GB

For character data, you have the following types at your disposal:

CHAR (or NCHAR)

A fixed-length character type right-padded with space characters up to its constraining size

VARCHAR2 (or NVARCHAR2)

A varying-length character type that can hold as many characters as will fit within its constraining size

LONG

A varying-length character type that can hold up to 2 GB ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required