Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: DBI place holder for sub query problem

by jZed (Prior)
on Jan 02, 2008 at 19:08 UTC ( #660037=note: print w/replies, xml ) Need Help??

in reply to DBI place holder for sub query problem

Generally, placeholders can only hold the place of *values*, not structural elements like table and column names and subselect queries. You can (for most DBDs, I believe) use placeholders for values in a subquery so something like this might work:
$sth=$dbh->prepare(" UPDATE tableA SET colA =( SELECT colB FROM tableB WHERE colC=? ) WHERE tableA.rec_no=? "); foreach my $row ( @rows ) { $sth->execute( $row->{'tableB.value'}, $row->{'tableA.value'} ) or die $dbh->errstr; }
Note that the order of the values in the execute is the order of the placeholders in the SQL, not the order the tables are opened.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://660037]
[LanX]: I remeber M::S (it was dialog driven?) to be buggy
[stevieb]: As far as Dist::Zilla goes, I don't like installing that other than on systems my test platorm runs on. I find it too heavy. I prefer being able to glean a Makefile.PL
[LanX]: what's frustrating me is that a distribution has lots of dupplicated info
[stevieb]: LanX I don't know if it's dialog driven; I just use it in the simplest of terms (just run module-starter at the CLI, and the very last couple of lines are how I use it.
[stevieb]: which dist are you speaking of regarding dups, LanX?
[LanX]: readme version number and so on ...
[stevieb]: with M::S, you can also add other tags, but defaults work... such as --license=perl --eumm

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2017-08-18 20:54 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (310 votes). Check out past polls.