Appendix A, Type Conversions

4D - Documentation   Français   English   German   English   4D for Oracle, Command Theme List   4D for Oracle, Command Alphabetical List   Back   Previous   Next

version 1.5


4D for Oracle enables you to bind 4th Dimension fields, variables, and arrays with Oracle columns and expressions. Since the data types in 4th Dimension and Oracle are not the same, 4D for Oracle converts the data from one type to another with the greatest possible flexibility.

For example, in the following query it is possible to bind the empno column, which is of type Number, with a 4th Dimension field, variable, or array whose type is Alpha, Text, Integer, Longint, Real, Boolean, or Time:

   SELECT empno FROM emp

This conversion works just as well going in the other direction.

The following tables summarize the conversion process. The first table summarizes conversions proceeding from Oracle to 4th Dimension. The second table summarizes conversions proceeding in the opposite direction, from 4th Dimension to Oracle.

From Oracle to 4th Dimension

Oracle4th DimensionConversion characteristics
CHARAlphaRestricted to the first 80 bytes for Alpha fields, 255 first bytes
for String variables.
TextNo restrictions.
Integer4D for Oracle keeps integer part. If result is outside
[-32768,32767], an error will occur.
Longint4D for Oracle keeps integer part. If result is outside
[-2147483648, 2147483647], an error will occur.
RealPlatform dependencies restrict conversion accuracy.
BooleanTrue if the string = "1", else False.
DateAlways converts to 0/0/0.
TimeAlways converts to 0:0:0.
PictureAlways converts to an empty picture.

NUMBERAlphaNo restrictions.
TextNo restrictions.
Integer4D for Oracle keeps integer part. If result is outside
[-32768;32767], an error will occur.
Longint4D for Oracle keeps integer part. If result is outside
[-2147483648, 2147483647], an error will occur.
RealPlatform dependencies restrict conversion accuracy.
BooleanFalse if = 0, else True.
DateAlways converts to 0/0/0.
TimeTreated as number of seconds since Midnight. 4D Oracle
keeps integer part. If the result is outside [-2147483648,
2147483647], an error will occur.
PictureAlways converts to an empty picture.

DATEAlpha4D short date format + space + 4D short time format
Text4D short date format + space + 4D short time format
IntegerAlways converts to 0.
LongintAlways converts to 0.
RealAlways converts to 0.
BooleanAlways false.
DateThe Oracle time is not read.
TimeThe Oracle date is not read.
PictureAlways converts to an empty picture.

LONGAlphaRestricted to the first 80 bytes for Alpha fields, 255 first bytes
for String variables.
TextNo restrictions.
Integer4D for Oracle keeps the integer part. If result is outside the
range [-32768;32767], an error will occur.
Longint4D for Oracle keeps the integer part. If result is outside
[-2147483648, 2147483647], an error will occur.
RealRestricted to SANE's conversion capacity.
BooleanTrue if string = "1", else False.
DateAlways converts to 0/0/0.
TimeAlways converts to 0:0:0.
PictureAlways converts to an empty Picture.

RAWAlphaRestricted to the first 80 bytes for Alpha fields, 255 first bytes
for Alpha variables.
TextTreated as LONG. No restrictions.
IntegerAlways converts to 0.
LongintAlways converts to 0.
RealAlways converts to 0.
BooleanAlways converts to False.
DateAlways converts to 0/0/0.
TimeAlways converts to 0:0:0.
PictureAlways converts to an empty Picture.

LONG RAWAlphaRestricted to the first 80 bytes for Alpha fields, 255 first bytes
for Alpha variables.
TextTreated as LONG. No restrictions.
IntegerAlways converts to 0.
LongintAlways converts to 0.
RealAlways converts to 0.
BooleanAlways converts to False.
DateAlways converts to 0/0/0.
TimeAlways converts to 0:0:0.
PictureBinary data must have been sent by 4D For Oracle originaly.

ROWIDAlphabbbbbbbb.llll.ffff
bbbbbbbb -> # of block in the file
llll -> # of line
ffff -> # of file
Textbbbbbbbb.llll.ffff
bbbbbbbb -> # of block in the file
llll -> # of line
ffff -> # of file
IntegerAlways converts to 0.
LongintAlways converts to 0.
RealAlways converts to 0.
BooleanAlways converts to False.
DateAlways converts to 0/0/0.
TimeAlways converts to 0:0:0.
PictureAlways converts to an empty picture.

From 4th Dimension to Oracle

4th DimensionOracleConversion characteristics
AlphaAll typesOracle receives the string as is. Restrictions are SQL ones.
TextAll typesOracle receives the string as is. Restrictions are SQL ones.
RealAll typesAfter the conversion of the string into the common
4D format (comma as "."), Oracle receives the string as is.
Restrictions are SQL ones.
IntegerAll typesAfter conversion into string, Oracle receives the string as is.
Restrictions are SQL ones.
LongintAll typesAfter conversion into string, Oracle receives the string as is.
Restrictions are SQL ones.
DateDateThe time on Oracle is set to 12:00:00.
TimeDateThe date on Oracle is set to January 1 of the current year.
BooleanAll typesAfter conversion into string ("0" for False and "1" for
True), Oracle receives the string as is. Restrictions are SQL
ones.
PictureLONG RAWSave the bunary data into a 4D for Oracle safe internal
format.No other type than LONG RAW is supported.


4D - Documentation   Français   English   German   English   4D for Oracle, Command Theme List   4D for Oracle, Command Alphabetical List   Back   Previous   Next