Re: ESQL/C question
Posted in 1997
You need to use a special identifier when declaring variables that will be used in SQL statements to make the "host variables". The way you do this is to preceed the variable declaration with a dollar sign, EXEC SQL, or a declare block. For simplicity, I'll give an example with the dollar sign. main() { int x; /* x is a normal C variable in this program */ $int y; /* y is an integer that can be used as the target for an SQL statement - it's a host variable */ $char str[64] /* 64 character string host variable */ ... } Your call looks ok to the stored proc. I'm not sure if stored procs can direct their output to a structure. You can do this with FETCHES of cursors. I'd stick with the host variable for now - just to get it working. -Bill > > I am a C programmer try to use ESQL/C. I have never used SQL. All I > have to do it call a stored procedure sending it one variable and > haveing 10 returned into a struct. > > Could someone please tell me how to do this? > Assuming this is the struct: > struct ABC { > char A; > char B; > } mystruct > > When I try to compile I get a message saying that field A does not > exist it struct MYSTRUCT. > > I then created variable to test the call such as: > char *buf1[]; > char *buf[2]; > but still could not get the variable to be filled correctly. > > I am trying to call the procedure SQL_FUNC sending the variable A and > haveing B,C,D returned. This is what I typed: > > EXEC SQL execute SQ_FUNC using :A > into :B :C :D > > Could someone please help me with this? > > dchamber@mindspring.com > -- Bill Ennis Voice: 312-474-7516 SSA Fax: 312-474-7460 500 W. Madison email: ennis@ssax.com ennis@accesschicago.net