char(1) columns, embedded SQL
Date: 8 Dec 1994 13:13:45 -0800
Message-ID: <3c7su9$rn6_at_venice.sedd.trw.com>
I want to insert and retrieve values in Oracle table columns of the char(1) type via embedded SQL. My current schematic procedure follows, where I am ignoring other columns in the table. Basically, I insert a one-character value into the table (assumed to be initially empty in this example), and try to retrieve that value.
EXEC SQL BEGIN DECLARE SECTION;
char charval[1];
EXEC SQL END DECLARE SECTION;
charval[0] = 'a';
EXEC SQL INSERT INTO MY_TABLE
(CHAR_1_COL) VALUES (:charval) ;
charval[0] = '\0';
EXEC SQL DECLARE len_test_cur CURSOR FOR
SELECT CHAR_1_COL FROM MY_TABLE;
EXEC SQL OPEN len_test_cur;
EXEC SQL FETCH len_test_cur into :charval;
EXEC SQL CLOSE len_test_cur;
printf("%c\n", charval[0]);
charval[0] appears to be filled with the correct value. My question is, is charval[1] (outside of the array bounds) overwritten with anything (null terminator, space, or anything else)? Received on Thu Dec 08 1994 - 22:13:45 CET