prepare error 410
Posted in 2012
An ESQL/C developer converted a static "update rcpf20 set *=(:rcpf20) where rowid=:rowid" into a PREPARE/EXECUTE pair and got error -410 (statement id not prepared), which indicates the PREPARE itself failed. One reply questioned the use of ROWID, but Art Kagel clarified ROWID is valid on non-fragmented IDS tables (WITH ROWIDS is only needed for fragmented ones). The suggested cause was a syntax error in the prepared text: it should read "update tab set (*) = (?) where rowid = ?" with the column list in parentheses and no colons on placeholders. No confirmation from the original poster is recorded.
Topics: Error Codes & Troubleshooting
HI, I modified the application from EXEC SQL update rcpf20 set *=(:rcpf20) where rowid=:rowid" to exec sql prepare s2 from "update rcpf20 set *=(:?) where rowid=?" for (;;) { EXEC sql execute s2 using :rcpf20,:rowid } :rcpf20 is a structure. When I execute the program, it report -410 error. Prepare statement failed or was not executed. This EXECUTE statement refers to a statement id that has not been prepared. Either no PREPARE statement was done, or one was done but returned an error code. Review the program logic to ensure that a statement is prepared and the PREPARE return code is checked. A negative error code from PREPARE usually reflects an error in the statement being prepared. Do anybody know what has happenend? How to avoid this problem?
>>> I modified the application from EXEC SQL update rcpf20 set *=(:rcpf20) where rowid=:rowid" to exec sql prepare s2 from "update rcpf20 set *=(:?) where rowid=?" for (;;) >>> 1. Which version of ESQL/C and IDS are you using? 2. Why are you using ROWID? That doesn't work with IDS unless the table was created with ROWID's, or your table is on an SE database. >>> { EXEC sql execute s2 using :rcpf20,:rowid } :rcpf20 is a structure. When I execute the program, it report -410 error. Prepare statement failed or was not executed. This EXECUTE statement refers to a statement id that has not been prepared. Either no PREPARE statement was done, or one was done but returned an error code. Review the program logic to ensure that a statement is prepared and the PREPARE return code is checked. A negative error code from PREPARE usually reflects an error in the statement being prepared. Do anybody know what has happenend? How to avoid this problem? >>>
Frank, ROWID is indeed supported in IDS. The WITH ROWIDS clause ONLY applies to fragmented tables which do not have a natural rowid pseudo value because the rowids or each fragment begin with the same value (equivalent of page 0 slot 1). But tables that are not fragmented do have a natural ROWID that you can use. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Wed, Aug 8, 2012 at 9:23 PM, FRANK J. COMPUTER <frank_in_pr@hotmail.com>wrote: > >>> > I modified the application from > > EXEC SQL update rcpf20 set *=(:rcpf20) where rowid=:rowid" > > to > > exec sql prepare s2 from "update rcpf20 set *=(:?) where rowid=?" > > for (;;) > >>> > > 1. Which version of ESQL/C and IDS are you using? > 2. Why are you using ROWID? That doesn't work with IDS unless the table was > created with ROWID's, or your table is on an SE database. > > >>> > { > > EXEC sql execute s2 using :rcpf20,:rowid > > } > :rcpf20 is a structure. > > When I execute the program, it report -410 error. > > Prepare statement failed or was not executed. > > This EXECUTE statement refers to a statement id that has not been prepared. > Either no PREPARE statement was done, or one was done but returned an error > code. Review the program logic to ensure that a statement is prepared and > the > PREPARE return code is checked. A negative error code from PREPARE usually > reflects an error in the statement being prepared. > > Do anybody know what has happenend? How to avoid this problem? > >>> > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --e89a8f3bac1de6aa8404c6cd8457
Hi, There is a syntax error in the statement your are preparing. Check the Informix guide to SQL syntax for the update statement. I think it should look more like: update tab set (*) = (?) where rowid=?; The * or column list needs to be in ()'s. I don't think you need the ":" in front of place holders. HTH, Jason