Search notes:

Perl module DBD::Oracle

use warnings;
use strict;

use DBI;
use DBD::Oracle;

my $username = shift;
my $password = shift;
my $database = shift || '';

my $dbh = DBI->connect("dbi:Oracle:$database", $username, $password) or die;

$dbh -> do ("create table tq84_dbi_oracle_table (id number primary key, tx varchar2(20))");

my $sth = $dbh -> prepare ("insert into tq84_dbi_oracle_table (id, tx) values (?,?)") or die;

for (my $i=0; $i<20; $i++) {
  $sth -> execute($i, '*' x $i);
}

# ---

$sth = $dbh -> prepare ("select * from tq84_dbi_oracle_table where mod(id, ?) = 0");
$sth -> execute(3); # print every 3rd record
$sth -> bind_columns( \my ($id, $tx) );

while ($sth -> fetch) {
  printf "%2i %20s\n", $id, $tx;
}

$sth -> finish;

# ---

$dbh -> do ("drop table tq84_dbi_oracle_table");
Github repository PerlModules, path: /DBD/Oracle/script.pl
Perl modules.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1741107577, '18.225.95.201', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/modules/DBD/Oracle/index(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78