投入文件:
1,a,USA,,
2,b,UK,,
3,c,USA,,
i 想从表一中提取数值来更新投入文件第4栏。
我的法典认为:
my $number_dbh = DBI->connect("DBI:Oracle:$INST", $USER, $PASS ) or die "Couldn t
connect to datbase $INST";
my $num_smh;
print "connected
";
open FILE , "+>>$input_file" or die "can t open the input file";
print "echo
";
while(my $line=<FILE>)
{
my @line_a=split(/,/,$line);
$num_smh = $number_dbh->prepare("SELECT phone_no from book where number = $line_a[0]");
$num_smh->execute() or die "Couldn t execute stmt, error : $DBI::errstr";
my $number = $num_smh->fetchrow_array();
$line_a[3]=$number;
}