VastbaseG100

基于openGauss内核开发的企业级关系型数据库。

Menu

执行查询

使用prepare查询

my $alexa = 3;
my $stmt = qq(SELECT id, name, address, salary  from COMPANY where id<?;);
my $sth = $dbh->prepare( $stmt );
my $rv = $sth->execute($alexa) or die $DBI::errstr;
if($rv < 0){
   print $DBI::errstr;
}
while(my @row = $sth->fetchrow_array()) {
      print "ID = ". $row[0] . "\n";
      print "NAME = ". $row[1] ."\n";
      print "ADDRESS = ". $row[2] ."\n";
      print "SALARY =  ". $row[3] ."\n\n";
}
$sth->finish;