Monday, April 2, 2012

Multiple statements won't work – single statements only.

I have a tabel s.

The commands I want to perform in the SQL prompt are:

INSERT INTO `s` (id, corpus_idcorpus, isdiscontinuous) VALUES ('d1s1',(select idcorpus from corpus where name="2003/А_он_мятежный_2.tgt"),false);
SET @DB_s_ids=last_insert_id();

I can perform the two commands separately, but get the following error, if I perform them in a batch.
Error 1064: 
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 'SET @DB_s_ids=last_insert_id' at line 2
  

I don't have problems running other queries in the batch.

Any hints?

No comments:

Post a Comment