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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

External Datatypes<br />

FLOAT<br />

The external datatype FLOAT processes numbers with fractional parts. The number<br />

is represented in the host system’s floating-point format. Normally, the length is 4<br />

or 8 bytes.<br />

The internal format of an <strong>Oracle</strong> number is decimal. Most floating-point<br />

implementations are binary. <strong>Oracle</strong>, therefore, represents numbers with greater<br />

precision than floating-point representations.<br />

INTEGER<br />

The external datatype INTEGER is used for converting numbers. An external integer<br />

is a signed binary number. Its size is operating system-dependent. If the number<br />

being returned from <strong>Oracle</strong> is not an integer, then the fractional part is discarded,<br />

and no error is returned. If the number returned exceeds the capacity of a signed<br />

integer for the system, then <strong>Oracle</strong> returns an overflow on conversion error.<br />

Note: A rounding error may occur when converting between<br />

FLOAT and NUMBER. Using a FLOAT as a bind variable in a query<br />

may return an error. You can work around this by converting the<br />

FLOAT to a string and using the OCCI type OCCI_SQLT_CHR or<br />

the OCCI type OCCI_SQLT_STR for the operation.<br />

INTERVAL DAY TO SECOND<br />

The external datatype INTERVAL DAY TO SECOND stores the difference between two<br />

datetime values in terms of days, hours, minutes, and seconds. Specify this datatype<br />

as follows:<br />

INTERVAL DAY [(day_precision)]<br />

TO SECOND [(fractional_seconds_precision)]<br />

This example uses the following placeholders:<br />

■ day_precision: Number of digits in the DAY datetime field. Accepted values<br />

are 1 to 9. The default is 2.<br />

■ fractional_seconds_precision: Number of digits in the fractional part of<br />

the SECOND datetime field. Accepted values are 0 to 9. The default is 6.<br />

To specify an INTERVAL DAY TO SECOND literal with nondefault day and second<br />

precisions, you must specify the precisions in the literal. For example, you might<br />

Datatypes 4-11

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

Saved successfully!

Ooh no, something went wrong!