#docslug#/ecob/ecob/V1.1.6/structure A structure (Struct) can be delivered as a whole when it is used as a host variable. The structure will be automatically split and allocated to each column of OceanBase Database when it is precompiled. Sample statement:
struct A {
int c1;
char c2[20];
};
struct A a;
memset(a.c2,0,20);
EXEC SQL CREATE TABLE t1 (c1 int, c2 varchar(100));
a.c1=10;
strcpy(a.c2,"test");
EXEC SQL INSERT INTO t1 values(:a);
The structure can also be used as an output host variable and its members are automatically parsed when it is precompiled. Sample statement:
struct A {
int c1;
char c2[20];
};
struct A a;
memset(a.c2,0,20);
EXEC SQL CREATE TABLE t1 (c1 int, c2 varchar(100));
EXEC SQL INSERT INTO t1 VALUES (1,'ABC');
EXEC SQL select c1,c2 INTO :a FROM t1 WHERE c1=1;