Issuing the CREATE TABLE Command

How to:

To return rows of table data to a client application, a program must first issue a CREATE TABLE command. It is a description of the answer set, telling the server the format of the row being returned (that is, the column name and type of data). The server uses that information to inform the client application, converting it to a format the client retrieves with the API function call EDAINFO.

The program then returns the actual rows of data in the table. The client application retrieves the data rows with the function call EDAFETCH.

A CREATE TABLE may not exceed 1,000 bytes in length.


Top of page

x
Syntax: How to Issue a Create Table
CREATE TABLE table_name ( col_name col_type[,...] )

where:

table_name

Is the name of the table to be created. The length and format of table_name must comply with standard SQL requirements.

col_name

Is the name of a column to be created. The length and format of col_name must comply with standard SQL requirements. The maximum number of columns permitted in one CREATE TABLE is 254.

col_type

Is the data type of the column. Possible values are:

Data Type

Description

CHAR(n)

for fixed-length alphanumeric, where n is less than 254. The value CHAR(10) is used for date formats.

SMALLINT

for two-byte binary integer.

INTEGER

for four-byte binary integer.

DECIMAL(p,s)

for packed decimal containing p digits with an implied number s of decimal points.

REAL

for four-byte, single-precision floating point.

FLOAT

for eight-byte, double-precision floating point.

As shown in the syntax, you must include a blank:

Blanks are not permitted in col_type definitions. For example:

When the CREATE TABLE specifies a DECIMAL value, the associated row must pass back the value as an eight-byte packed field. For example,

DECIMAL(13,2)

and

DECIMAL(5,2)

would require an eight-byte packed field.

In COBOL, both the above fields are defined as:

PIC S9(13)V99 COMP-3

or

PIC S9(15)    COMP-3


iWay Software