Re: multi-statement prepare
Posted in 1997
Douglas Wilson <dgwilson@gte.net> wrote: :I recieved a syntax error on something similar to :the following sort of prepare: Check sqlca.sqlerrd[5] for the character position of the syntax error. That's allways the basis for further analysis. :let sql_stmt= :"update tbl1 set (col1, col2)= ", :"(col1+1, (col3/col4)*100) ", :"where col2=? and col4!=0; ", :"update tbl1 set (col1, col2)= ", :"(col1+1, (col3/20)*100) ", :"where col2=? and (col4=0 or col4 is null); ", :"update tbl2 set (col1)=(col1+1) where col2=?;" : :prepare sql_id from sql_stmt : :I understand that you're supposed to think of the :statements as a unit which get executed in no particular :order (even though I found an example in the manual which :drops a table then creates one with the same name), :therefore you could get into trouble updating the same :table twice in the same statement, but this example :updates mutually exclusive rows in tbl1. : :Has anyone else ever experienced this? Apparently :I'm the first to report this. Any opinions on whether :or not it's a real problem? You might of course prepare 3 separate statements. I don't know if you gain any significant advantages from combining these updates into one statement. I would doubt it though. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org