Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Followup on executing multiple mysql commands in one call

by poj (Priest)
on May 31, 2012 at 08:02 UTC ( #973456=note: print w/ replies, xml ) Need Help??


in reply to Followup on executing multiple mysql commands in one call

Use a stored procedure like this maybe,

my $create_proc_upd = <<'eof'; CREATE PROCEDURE upd() BEGIN SET @tid:=(SELECT Team_ID FROM Teams WHERE Name='Thunder'); UPDATE Games SET Away_Team_ID=@tid WHERE Date='2012-05-29'; SET @tid:=(SELECT Team_ID FROM Teams WHERE Name='Spurs'); UPDATE Games SET Home_Team_ID=@tid WHERE Date='2012-05-29' END eof $dbh->do('DROP PROCEDURE IF EXISTS upd'); $dbh->do($create_proc_upd); $dbh->do('CALL upd');
poj


Comment on Re: Followup on executing multiple mysql commands in one call
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973456]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (18)
As of 2015-07-29 17:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (266 votes), past polls