Inserting Null Values With Indicator VariablesTo insert a null value in the table, the application program has to set the indicator variable to negative one and then execute an INSERT or UPDATE c-treeSQL statement specifying the indicator variable. The following example shows the declaration and usage of an indicator variable (qty_i) to insert a null value into the orders table. Example Using Indicator Variables to Insert Null Values
EXEC SQL BEGIN DECLARE SECTION ;
char order_date_v [10] ; char product_v [5] ; long qty_v ; short qty_i ;
/* as -1 for inserting null */ qty_i = -1 ;
INSERT INTO orders (order_no, product, qty) VALUES (:order_no_v, :product_v, :qty_v:qty_i) ; ... |
|||