If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Multiple statements in single query batch

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-16-05, 08:54
elorob elorob is offline
Registered User
 
Join Date: Sep 2005
Posts: 4
Multiple statements in single query batch

Hi,

Can anyone advise how to execute multiple statements in a single query
batch. For example-

update customers set customer_name = 'Smith' where customer_name =
'Smyth';
select * from customers;

I can execute each statement individually but get the 'you have an error in
you SQL syntax' when trying to execute them together.
Ultimately I'm looking to build multi-statement queries (some may contain
transactions) that do lots of work and then return a result for the client
to use :-

INSERT customers
(customer_name)
VALUES
(ucase('test3'));

SELECT c.customer_id, c.customer_name
FROM customers c
WHERE c.customer_name = ucase('test3');

Can anyone tell me what I'm missing?

Thanks,

DG
Reply With Quote
  #2 (permalink)  
Old 10-16-05, 20:08
cornercuttin cornercuttin is offline
Registered User
 
Join Date: Aug 2005
Location: Oklahoma
Posts: 9
this question has been asked before. try doing a search in this forum, it shouldnt be hard to find a solution.

good luck
Reply With Quote
  #3 (permalink)  
Old 10-16-05, 20:14
popskie popskie is offline
Registered User
 
Join Date: Oct 2004
Location: In cousin's house
Posts: 303
if u r using mysal 5.0 above then u can use create procedure
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On