[Date Index] [Thread Index] [Author Index]
How to execute multiple statements from one SQLExecute?
I would like to execute some SQL (MySQL) that looks like this: UPDATE Table1 SET (...) WHERE Column1='SomeValue'; IF row_count() =0 INSERT INTO Table1 VALUES (...) But when I try it, Mathematica gives me the error: JDBC::error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF row_count ()=0 ... Trying another simpler test yields a similar problem: SQLExecute[conn, "SELECT * FROM TABLE1;SELECT row_count()"]; If I put the semi-colon at the end of a single statement everything is fine, but a second statement chokes SQLExecute. Therefore I'm assuming that my delimiter is ok, but that SQLExecute can't handle multiple statements. How can I get Mathematica to feed multiple statements through? Obviously if I send a second SQLExecute, row_count() is not going to be valid! Thanks, Michael