version 6.0 (Modified)
OD Clone 4D Table (login_ID{; 4DTableNumber{; options}}) Integer
| Parameter | Type | Description | |
| login_ID | Longint | Connection Identifier | |
| 4DTableNumber | Integer | 4D Table Number | |
| options | Longint | Options | |
| Function result | Integer | Error code (1 = the operation is successful, | |
| 0 = the user clicks Cancel, -1 = an error occurs) |
Description
The OD Clone 4D Table function creates an Oracle table with column definitions equivalent to a 4th Dimension table.
login_ID must be a valid connection identifier.
4DTableNumber is the number of the 4th Dimension table, the structure of which is duplicated.
options is a combination of options. Several options can be chosen by adding their values. The options are the following:
| Option | Description |
| kReplace=1 | OD Clone 4D Table generates a DROP TABLE statement before creating |
| the new table. | |
| kWithoutSubtable=2 | OD Clone 4D Table ignores subtables. The cloning of subtables is not |
| currently supported. This option must be requested for any table | |
| containing a subtable. | |
| kWithoutText=4 | OD Clone 4D Table ignores fields of type Text. |
| kWithoutPicture=8 | OD Clone 4D Table ignores fields of type Picture. |
| kWithout=16 | OD Clone 4D Table ignores fields of type Blob. |
If 4DTableNumber is not specified, OD Clone 4D Table displays the Clone a Table dialog box.
The pop-up menu allows you to choose the 4th Dimension table to be cloned and the check boxes list the available options.
The new table has the name of the 4th Dimension table and its columns have the names of the fields in the 4th Dimension table. If a field name contains spaces, the spaces are replaced by underscores.
Types are converted according to the following rules:
| 4th Dimension | Oracle |
| Alpha (length) | CHAR(long) |
| Text | LONG |
| Real | FLOAT |
| Integer | INTEGER |
| Longint | INTEGER |
| Date | DATE |
| Hour | DATE |
| Boolean | NUMBER(1) |
| Picture | LONG RAW |
If a 4th Dimension field has the Mandatory attribute, the corresponding column is created with the NOT NULL option.
An index is created for each indexed field. Its name is a concatenation of the 4th Dimension table name, the "$" sign, and the field name, prefixed by "I_" suffix. For example, an index for the Sal field of the EMP table would be named "I_EMP$SAL".
If a 4th Dimension field has the Unique attribute, the index is created with the UNIQUE option.
Note: In Oracle Version 6, certain restrictions exist for typing columns. For example, there cannot be more than one column of LONG RAW type per table, and the maximum size of a column is 64K. Refer to your Oracle Reference manual for more information.
OD Clone 4D Table returns 1 if the operation is successful, -1 if an error occurs, or 0 if the user clicks Cancel.
Example
The following method copies the tables in the 4th Dimension database to the Oracle server. If a table already exists on the server, it is automatically replaced.
Login_ID:=OD Login dialog If (Login_ID>0) For($i;1;Count tables) rc:=OD Clone 4D Table (Login_ID;$i;1) End for End if
See Also
System Variables and Sets
If the user clicks OK, the OK system variable is set to 1. If the user clicks Cancel, the OK system variable is set to 0.