The following table matches Clarion data types to their corresponding Oracle data types.
Generally, you should not have to do any manual matching of data types. Rather, you simply import file definitions from your Oracle database into your Clarion data dictionary. The Oracle Accelerator driver automatically selects the proper data types (see Importing Oracle Files to a Data Dictionary).
Oracle data type | Clarion data type |
CHAR | STRING |
VARCHAR2 | CSTRING |
NUMBER | REAL |
NUMBER(n,p) | PDECIMAL |
NUMBER(n,0) | BYTE1,SHORT2,USHORT3,LONG4 |
LONG | STRING+GROUP+SHORT5 |
LONG RAW | STRING+GROUP+SHORT5 |
DATE | DATE or STRING+DATE+TIME6 |
RAW | STRING |
ROWID | STRING(18) |
Data Type Notes:
1 CREATE will create a NUMBER(3,0).
2 CREATE will create a NUMBER(5,0).
3 CREATE will create a NUMBER(5,0).
4 CREATE will create a NUMBER(10,0).
5 Clarion can access Oracle LONG and LONG RAW data types by using a STRING and a GROUP overlaying the STRING. The GROUP consists of a SHORT and a STRING. The SHORT holding the length of the total data (including the length of the SHORT). For example:
Comments STRING(1024),NAME('COMMENTS') !Oracle LONG field
COMMENTS_GROUP GROUP,OVER(Comments)
COMMENTS_LENGTH USHORT
COMMENTS_DATA STRING(1022)
END
You cannot use the CREATE statement to create rows of type LONG or LONG RAW.
6 Clarion can access Oracle DATE data types by using either a DATE or a STRING with a GROUP overlaying the STRING.
If you use a Clarion DATE field, the TIME component of the field is not readable and is set to 0 when writing the field. You may use a CREATE statement to create the table. For example:
StartDate DATE,NAME('START_DATE') !Oracle DATE field
If you use a Clarion STRING with an overlaid GROUP, the GROUP consists of a DATE and a TIME field. You may not use a CREATE statement to create the table. For example:
OraDate STRING(8),NAME('START_DATE') !Oracle DATE field
StartDate_Group GROUP,OVER(OraDate)
StartDate DATE
StartTime TIME
END
Your Clarion application should generally reference the DATE field (StartDate), and should not reference the STRING field (OraDate) or the GROUP field (StartDate_Group).
However, if the Oracle date stamp is part of the key, you must include the STRING field (not the DATE field) as a key component in your Clarion data dictionary.
7 Oracle ROWID data types are read and written as a STRING(18) of format BBBBBBBB.RRRR.FFFF. Where B, R, and F are hexadecimal numbers representing block, row, and file number respectively. See your Oracle documentation for more information.
CREATE will not create a ROWID row.