BC remote Oracle DBA - Call (800) 766-1884  
Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation








EnterpriseDB: INTERVAL

Oracle Tips by Burleson Consulting

An interval is a period of time, like the time it takes you to leave your house and the time it takes you to drive to work is an interval of time.  An interval is the difference between a starting point in time and an ending point in time (my, how 4th dimensional!).

Intervals also (like a timestamp) accept an optional precision of 1-6.  That precision determines the granularity of the unit chosen.  The available units of time are:  second, minute, hour, day, week, month, year, decade, century, or millennium.

A date, let's say 01-JAN-2006 added to INTERVAL '1 YEAR', DATE '01-JAN-2006' + INTERVAL '1 YEAR', would equal 01-JAN-2007.  That same date added to INTERVAL '6 MONTHS' would equal 01-JUL-2006.

The uses of INTERVAL are somewhat limited.  I have rarely needed them and had they not been available, I could have made do with a NUMBER field or a DATE field.  I would recommend that you not use INTERVAL unless migrating an application that uses it already.

There are no synonyms for interval.

CREATE TABLE date_table (
  date_field DATE,
  ts_field   TIMESTAMP(6),
  int_field  INTERVAL );

We can insert some values: 

INSERT INTO date_table ( date_field, ts_field, int_field )
  VALUES (to_date('01-JAN-2007 12:33:54', 'DD-MON-YYYY HH24:MI:SS'),
          to_timestamp('01-JAN-2007 12:33:54.123456',
                       'DD-MON-YYYY HH24:MI:SS.us'),
          INTERVAL '1 Year' );

* EnterpriseDB does not support the .ff fractional seconds syntax that Oracle supports.  It does not produce an error but only returns a 0.  Use .ms for milliseconds and .us for microsends. 

And we can select those values back out:

SELECT date_field, ts_field, int_field
  FROM date_table; 

edb=# CREATE TABLE date_table (
edb(#   date_field DATE,
edb(#   ts_field   TIMESTAMP(6),
edb(#   int_field  INTERVAL );


edb=# INSERT INTO date_table ( date_field, ts_field, int_field )edb-#   VALUES (to_date('01-JAN-2007 12:33:54', 'DD-MON-YYYY HH24:MI:SS'),
edb(#           to_timestamp('01-JAN-2007 12:33:54.123456',
edb(#                        'DD-MON-YYYY HH24:MI:SS.us'),
edb(#           INTERVAL '1 Year' );
edb=# SELECT date_field, ts_field, int_field
edb-#   FROM date_table;

     date_field     |         ts_field          | int_field
 01-JAN-07 12:33:54 | 01-JAN-07 12:33:54.123456 | @ 1 year

(1 row)


Binary Data

Binary data is data that is not interpreted by the database.  For example, a string of data, let's use "Lewis" as an example, is stored as 1s and 0s on the physical disk but the database interprets those 1s and 0s so that it comes out "Lewis".  If you switched to a different language, you could translate that word into its foreign language counterpart.  This is known as having a locale.

A digital image is a binary file.  The data would be stored as 1s and 0s and the database would never try to interpret what those 1s and 0s mean.  If you switched to another language, it would still just be 1s and 0s.  Binary data has no locale.

This is an excerpt from the book "EnterpriseDB: The Definitive Reference" by Rampant TechPress.

Expert Remote DBA

BC is America's oldest and largest Remote DBA Oracle support provider.  Get real Remote DBA experts, call
BC Remote DBA today.



Remote DBA Service

Oracle Tuning Book


Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software







BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.

Hit Counter