10.12.2012 Views

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

External Datatypes<br />

For byte 1, 119 represents the twentieth century, 1900 to 1999. A value of 120<br />

would represent the twenty-first century, 2000 to 2099.<br />

For byte 2, the second and third digits of the year are calculated as the year modulo<br />

100. With a modulo division, the nonfractional portion is discarded:<br />

1992 % 100 = 92<br />

For byte 2, 192 represents the ninety-second year of the current century. A value of<br />

100 would represent the zeroth year of the current century.<br />

The year 2000 would yield 120 for byte 1 and 100 for byte 2.<br />

For years prior to 0 CE, centuries and years are represented by the difference<br />

between 100 and the number. So 01-JAN-4712 BCE is century 53 because 100 - 47 =<br />

53. The year is 88 because the 100 - 12 = 88.<br />

Valid dates begin at 01-JAN-4712 BCE. The month byte ranges from 1 to 31, the<br />

hour byte ranges from 1 to 24, and the second byte ranges from 1 to 60.<br />

When you enter a date in binary format by using the external datatype DATE, the<br />

database does not perform consistency or range checking. All data in this format<br />

must be validated before input.<br />

When a DATE column is converted to a character string in your program, it is<br />

returned in the default format mask for your session, or as specified in the<br />

INIT.ORA file.<br />

Note that this datatype is different from OCCI DATE which corresponds to a <strong>C++</strong><br />

Date datatype.<br />

4-10 <strong>Oracle</strong> <strong>C++</strong> <strong>Call</strong> <strong>Interface</strong> Programmer’s <strong>Guide</strong><br />

Note: If no time is specified for a date, the time defaults to<br />

midnight: 1, 1, 1.<br />

Note: There is little need for the external datatype DATE. It is more<br />

convenient to convert DATE values to a character format, because<br />

most programs deal with dates in a character format, such as<br />

DD-MON-YYYY. Instead, you may use the Date datatype.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!