Skip the INTO -- INTO can never be prepared.
If the SP returns values, declare a cursor for the prepared
statement. Use 'OPEN c_name USING :variable, ...' to supply the
(input) arguments to the SP. Use 'FETCH c_name INTO :variable,...'
to collect the (output) results.
I think this is covered in the ESQL/C Manuals; certainly at
7.10 and later, somewhat less thoroughly, perhaps, in earlier
versions.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
}From: william@carsinfo.com (William Harris)
}Date: 23 May 1995 16:12:54 GMT
}X-Informix-List-Id: <news.14137>
}
}We're running Informix 5.03UC1 on a couple of different hardware
}platforms. The question has come up about execute a dynamically
}specified stored procedure in ESQL/C.
}
}sprintf(string, "execute procedure %s(%d, %d, %d) into ?"
}$prepare sp_id from $string;
}
}returns an SQLCODE of -201 (a generic syntax error). Without the "into
}?", it prepares okay, but later, on the execute statement, if we $execute
}sp_id using an sqlda structure, it gives us error -254, which is that too
}many or too few host variables are used. [...]