bigup401 has asked for the wisdom of the Perl Monks concerning the following question:
i want to run 2 sql query at once like similier example
#!/usr/bin/perl use strict; use warnings; my $sql = " CREATE TABLE test_dbi1 ( test_dbi_intr_no NUMBER(15), test_dbi_name VARCHAR2(100) ); UPDATE mytable SET col1=';yes;' WHERE col2=1; UPDATE mytable SET col1='Don\\'t use ;s and \\'s together, it is a pain' WHERE col2=1; CREATE TABLE test_dbi2 ( test_dbi_intr_no NUMBER(15), test_dbi_name VARCHAR2(100) ); ";
here is mine. i want to do it like slimier with placeholders
#deduct from the transferred account $update = $DBH->prepare("UPDATE USER SET BALANCE = BALANCE - ? WHERE U +SERNAME = ?"); $update->execute($amount, $user); $up = $update->finish(); #add to the receiving account $update1 = $DBH->prepare("UPDATE USER SET BALANCE = BALANCE + ? WHERE +USERNAME = ?"); $update1->execute($amount, $user); $up1 = $update1->finish();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: run 2 query mysql
by marto (Cardinal) on Mar 04, 2019 at 15:22 UTC | |
by bigup401 (Pilgrim) on Mar 04, 2019 at 15:56 UTC | |
by davido (Cardinal) on Mar 04, 2019 at 16:44 UTC | |
by marto (Cardinal) on Mar 04, 2019 at 16:04 UTC | |
|
Re: run 2 query mysql
by Marshall (Canon) on Mar 04, 2019 at 18:10 UTC | |
by afoken (Chancellor) on Mar 04, 2019 at 18:46 UTC | |
by Marshall (Canon) on Mar 04, 2019 at 20:31 UTC |