SQL/MP Installation and Management Guide

Creating a Database
HP NonStop SQL/MP Installation and Management Guide523353-004
5-29
Defining Columns
Defining Corresponding Columns in Different Tables
Data type cross-matching between tables is the responsibility of the database
administrator. You must ensure that corresponding columns used in different tables are
defined with the same characteristics: data type, size, default values, and constraints.
For example, a part-number column defined in several tables should have the same
definition. Do not define one column as PIC X(4) and another as PIC 9(4). By using the
same column definition, you ensure that applications can perform join operations
during data retrieval or predicate comparisons.
Understanding Data Type Correspondence With Host
Languages
Data type correspondence between SQL/MP and the host programming languages
supported for embedded SQL is shown in Table 5-1. The table lists selected column
data types representing different possible data descriptions generated by INVOKE
statements.
Table 5-1. Summary of Corresponding Data Types (page1of3)
SQL/MP Column
Name and Data
Type COBOL C Pascal TAL
A CHAR(10)
PIC X(10)
NCHAR (10)
PIC X(10). char a[11]; fstring(10); string a[0:9];
B VARCHAR(10)
NCHAR
VARYING(10)
02 B.
03 LEN
PIC S9(4)
COMP.
03 VAL PIC
X(10).
struct {
short len;
char val[11];
}b;
string(10); struct b;
begin
int len;
string val[0:9];
end;
C CHAR(10)
CHAR SET y
PIC X(10)
CHAR SET y
NCHAR (10)
01 B
CHARACTER
SET y
PIC X(10).
char
CHARACTER
SET y
a[11];
fstring(10)
CHARACTE
R SET y;
string
CHARACTER
SET y
a[0:9];
D VARCHAR(10)
CHAR SET y
NCHAR
VARYING(10)
01 B.
02 LEN
PIC S9(4)
COMP.
02 VAL
CHARACTER
SET y
PIC X(10).
struct {
short len;
char
CHARACTER
SET y
val[11];
}b;
string(10)
CHARACTE
R SET y;
struct b;
begin
int len;
string
CHARACTER
SET y
val[0:9];
end;