Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to execute multiple statements from one SQLExecute?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99870] How to execute multiple statements from one SQLExecute?
  • From: Michael <michael2718 at gmail.com>
  • Date: Mon, 18 May 2009 02:29:23 -0400 (EDT)

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


  • Prev by Date: Re: PlotLegend
  • Next by Date: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter
  • Previous by thread: Re: "SelectionData" and palettes
  • Next by thread: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter