Appendix A, Type Conversions
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
| Oracle | 4th Dimension | Conversion characteristics |
| CHAR | Alpha | Restricted to the first 80 bytes for Alpha fields, 255 first bytes |
| | for String variables. |
| Text | No restrictions. |
| Integer | 4D for Oracle keeps integer part. If result is outside |
| | [-32768,32767], an error will occur. |
| Longint | 4D for Oracle keeps integer part. If result is outside |
| | [-2147483648, 2147483647], an error will occur. |
| Real | Platform dependencies restrict conversion accuracy. |
| Boolean | True if the string = "1", else False. |
| Date | Always converts to 0/0/0. |
| Time | Always converts to 0:0:0. |
| Picture | Always converts to an empty picture. |
| NUMBER | Alpha | No restrictions. |
| Text | No restrictions. |
| Integer | 4D for Oracle keeps integer part. If result is outside |
| | [-32768;32767], an error will occur. |
| Longint | 4D for Oracle keeps integer part. If result is outside |
| | [-2147483648, 2147483647], an error will occur. |
| Real | Platform dependencies restrict conversion accuracy. |
| Boolean | False if = 0, else True. |
| Date | Always converts to 0/0/0. |
| Time | Treated as number of seconds since Midnight. 4D Oracle |
| | keeps integer part. If the result is outside [-2147483648, |
| | 2147483647], an error will occur. |
| Picture | Always converts to an empty picture. |
| DATE | Alpha | 4D short date format + space + 4D short time format |
| Text | 4D short date format + space + 4D short time format |
| Integer | Always converts to 0. |
| Longint | Always converts to 0. |
| Real | Always converts to 0. |
| Boolean | Always false. |
| Date | The Oracle time is not read. |
| Time | The Oracle date is not read. |
| Picture | Always converts to an empty picture. |
| LONG | Alpha | Restricted to the first 80 bytes for Alpha fields, 255 first bytes |
| | for String variables. |
| Text | No restrictions. |
| Integer | 4D for Oracle keeps the integer part. If result is outside the |
| | range [-32768;32767], an error will occur. |
| Longint | 4D for Oracle keeps the integer part. If result is outside |
| | [-2147483648, 2147483647], an error will occur. |
| Real | Restricted to SANE's conversion capacity. |
| Boolean | True if string = "1", else False. |
| Date | Always converts to 0/0/0. |
| Time | Always converts to 0:0:0. |
| Picture | Always converts to an empty Picture. |
| RAW | Alpha | Restricted to the first 80 bytes for Alpha fields, 255 first bytes |
| | for Alpha variables. |
| Text | Treated as LONG. No restrictions. |
| Integer | Always converts to 0. |
| Longint | Always converts to 0. |
| Real | Always converts to 0. |
| Boolean | Always converts to False. |
| Date | Always converts to 0/0/0. |
| Time | Always converts to 0:0:0. |
| Picture | Always converts to an empty Picture. |
| LONG RAW | Alpha | Restricted to the first 80 bytes for Alpha fields, 255 first bytes |
| | for Alpha variables. |
| Text | Treated as LONG. No restrictions. |
| Integer | Always converts to 0. |
| Longint | Always converts to 0. |
| Real | Always converts to 0. |
| Boolean | Always converts to False. |
| Date | Always converts to 0/0/0. |
| Time | Always converts to 0:0:0. |
| Picture | Binary data must have been sent by 4D For Oracle originaly. |
| ROWID | Alpha | bbbbbbbb.llll.ffff |
| | bbbbbbbb -> # of block in the file |
| | llll -> # of line |
| | ffff -> # of file |
| Text | bbbbbbbb.llll.ffff |
| | bbbbbbbb -> # of block in the file |
| | llll -> # of line |
| | ffff -> # of file |
| Integer | Always converts to 0. |
| Longint | Always converts to 0. |
| Real | Always converts to 0. |
| Boolean | Always converts to False. |
| Date | Always converts to 0/0/0. |
| Time | Always converts to 0:0:0. |
| Picture | Always converts to an empty picture. |
From 4th Dimension to Oracle
| 4th Dimension | Oracle | Conversion characteristics |
| Alpha | All types | Oracle receives the string as is. Restrictions are SQL ones. |
| Text | All types | Oracle receives the string as is. Restrictions are SQL ones. |
| Real | All types | After the conversion of the string into the common |
| | 4D format (comma as "."), Oracle receives the string as is. |
| | Restrictions are SQL ones. |
| Integer | All types | After conversion into string, Oracle receives the string as is. |
| | Restrictions are SQL ones. |
| Longint | All types | After conversion into string, Oracle receives the string as is. |
| | Restrictions are SQL ones. |
| Date | Date | The time on Oracle is set to 12:00:00. |
| Time | Date | The date on Oracle is set to January 1 of the current year. |
| Boolean | All types | After conversion into string ("0" for False and "1" for |
| | True), Oracle receives the string as is. Restrictions are SQL |
| | ones. |
| Picture | LONG RAW | Save the bunary data into a 4D for Oracle safe internal |
| | format.No other type than LONG RAW is supported. |