bind.pl
来自「perl learn perl by examples」· PL 代码 · 共 22 行
PL
22 行
use DBI;
$dbname = 'DEMO732'; $user = 'scott';
$password = 'tiger'; $dbd = 'Oracle';
$dbh = DBI->connect ($dbname, $user, $password, $dbd);
if (!$dbh) {
print "Error connecting to database; $DBI::errstr\n";
}
$sth = $dbh->prepare(q{select name, age from emptable where age < 40});
$sth->execute();
die "Prepare error: $DBI::err .... $DBI::errstr" if $DBI::err;
$sth->bind_columns(undef, \($name, $age));
# Column binding is the most eficient way to fetch data
while($sth->fetch) {
print "$name: $age\n";
}
$sth->finish();
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?