Re: ESQL/C question
Posted in 1997
Don Chambers wrote: > > 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 Hi, ... function() { EXEC SQL BEGIN DECLARE SECTION; struct ABC { char A[ 2 ]; char B[ 2 ]; char C[ 2 ]; } mystruct; EXEC SQL END DECLARE SECTION; strcpy( mystruct.A, "A" ); EXEC SQL EXECUTE PROCECURE SQL_FUNC( :mystruct.A ) INTO :mystruct.B, :mystruct.C; ... } Your stored procedure must not return more than one row. Otherwise you must use a cursor to fetch the rows. Bye Stefan