MySQL Forums
Forum List  »  Perl

how to update row by replacing substitution
Posted by: srey bo
Date: August 06, 2007 10:43PM

Hi,
This is my sample data (tbl):
id firstname lastname
1 aaabbb aaacccc
2 aaaddd aaaeeee
3 aaafff aaagggg

I want to replace aaabbb by bbb, aaaddd by ddd, and so on.
so i use sql statement like this in perl:

my $sth=$dbh->prepare("update tbl set firstname=(firstname =~ s/^aaa//) where id=?");
$sth->execute($id);

It doesn't work.
Have any idea?
please help me.....

Options: ReplyQuote


Subject
Written By
Posted
how to update row by replacing substitution
August 06, 2007 10:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.