Pro*C bind variables to Insert Blanks

From: John W. Bito <jwb_at_megasoft.com>
Date: 1997/04/09
Message-ID: <860634738.13397_at_dejanews.com>#1/1


[Quoted] [Quoted] I have encountered a behavior that I don't expect using Pro*C dynamic embedded SQL. When I bind a string buffer to a variable in the VALUES clause of
INSERT INTO x VALUES (:var, :othervar)
where the table looks like
CREATE TABLE x (col1 CHAR(15), col2 CHAR(15)) I populate the sqlda like this

char var[15], othervar[15];
memset(var, ' ', 15);
memset(othervar, ' ', 15);

[Quoted] sqlda.V[0] = &var;
sqlda.T[0] = 1 /* CHAR */
sqlda.L[0] = 15;
sqlda.I[0] = NULL;
sqlda.V[1] = &othervar;
sqlda.T[1] = 1 /* CHAR */
sqlda.L[1] = 15;
sqlda.I[1] = NULL;

[Quoted] I want to have a row with two columns of fifteen blanks. Instead, I get a row with two null columns. This is a trivial example of a problem that is rather painfull in that I have many columns that have <blank> (spaces) as a valid, non-nul value. I know I can get Oracle to insert these rows using
INSERT INTO x VALUES (' ', ' ') but this is impractical, since all my embedded SQL would have to be coded N times, where N is the number of colums that are allowed to be <blank>.

Thanks for your assistance,
John Bito
DataFocus, Inc.
jwb_at_DataFocus.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Wed Apr 09 1997 - 00:00:00 CEST

Original text of this message