| |
 |
|
Oracle COMMIT and
ROLLBACK
Oracle Tips by
Burleson
|
In order to save changes to the database, you must issue a
COMMIT statement. This instructs Oracle that your changes are
complete and that the database should write the changes to the data
and release any locks that you have on database objects.
If you make a mistake and wish to have your changes to the database
erased, you must issue a ROLLBACK statement. This instructs the
database to discard your changes and release any locks that you have
on database objects.
Datatypes
Table 2.1 shows a complete list of internal datatypes used by the
Oracle7 database.
|
Table 2.1 Datatypes used by the Oracle7 database.
|
|
Datatype |
Description |
|
char |
A fixed-length datatype, having a maximum
width of 255 bytes. A size must be specified. A single character
takes one byte in most systems, although some systems use
multibyte characters. |
|
varchar |
In Oracle7, this is the same as the
varchar2 datatype (below). However, Oracle suggests that the
function of this type will change in a future release. Developers
and DBAs are advised not to use this datatype; instead, use the
varchar2 datatype. |
|
varchar2 |
A variable length character string of up to
2,000 bytes. A maximum length for the column must be defined. |
|
rowid |
Not a real datatype, rowid is a
pseudocolumn that is stored for each row of data in the database.
A rowid is the physical location of a row on disk and
allows Oracle to quickly access the data contained in the row.
|
|
date |
A fixed length field that is seven bytes in
length. Time is stored along with the date in this format. The
default format for dates is DD-MM-YY HH:MM:SS AM (For example,
01-JAN-98 12:00:01 AM). Any date between 4712 BC and AD 4712 can
be stored. The time of day is stored using a
seconds-since-midnight algorithm. |
|
number |
A variable length column that holds real
values as well as integer values. Precision and scale can be
specified. Up to 38 significant digits can be stored. The ANSI
standard float may also be used; this is synonymous with
the number type. |
|
long |
A variable length column that can hold up to
2 GB of data, most commonly used to store character data for which
a varchar2 column is inappropriate. |
|
raw |
A variable length column used to store binary
data and can be up to 255 bytes in length. A size must be defined.
|
|
longraw |
A variable length column, similar to the
raw type, that has a length of up to 2 GB. This type might be
used to store music or image files. |
|
mlslabel |
This is the binary format of a secure
operating system label. It is primarily used with Trusted Oracle,
but can be used with standard Oracle as well. |
The most common datatypes that you’ll encounter are date,
varchar2, and number (and their subtypes). Even in
databases that use the other datatypes, the majority of the columns
tend to be of these three types.
Converting Data of Different
Types
Oracle has two methods of converting data between differing types:
-
Implicit conversion of a datatype can be
performed automatically. Oracle will attempt to convert data from
one type to another if types are mixed in an expression.
-
Explicit conversion of datatypes is
provided via SQL functions.
Oracle Corporation recommends that explicit data conversion always
be used for a number of reasons, including:
-
SQL code is easier to understand.
-
Implicit conversions can have a negative
performance impact.
-
Implicit conversions rely on the context in
which the columns are referenced and will not always work
consistently.
-
Oracle Corporation might choose to change the
functionality of implicit conversions in a future release.
This is an
excerpt from the book "High Performance Oracle Database
Automation" by Jonathan Ingram and Donald K. Burleson, Series
Editor. |