Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 having an uproarious good time at the Monastery: (9)
As of 2014-08-22 06:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (148 votes), past polls