Fixed-size lvarchar host variables
The following figure shows how to use a fixed-size lvarchar host
variable to insert and select data in the circle_col column
of the circle_tab table (see Figure 4).
Figure 1. Accessing the
external format of the circle opaque data type
EXEC SQL BEGIN DECLARE SECTION;
lvarchar 'circle' lv_circle[30];
char *x_coord;
EXEC SQL END DECLARE SECTION;
/* Insert a new circle_tab row with a literal opaque
* value */
EXEC SQL insert into circle_tab
values ('(3.00, 2.00, 11.5)');
/* Insert data into column circle of table circle_tab using an lvarchar host
* variable */
strcpy(lv_circle, "(1.00, 17.00, 15.25)");
EXEC SQL insert into circle_tab values (:lv_circle);
/* Select column circle in circle_tab from into an lvarchar host variable
*/
EXEC SQL select circle_col into :lv_circle
from circle_tab
where radius(circle_col) = 15.25;