
   use DBI;
   use strict 'vars';

   my $dbh = DBI->connect("DBI:Oracle:TEST", "mjd", "gandalf",
                          { RaiseError => 1 });
   my $sth = $dbh->prepare("SELECT surname, givenname, city 
                              FROM authors
                             WHERE id = ?");

   while (1) {
     print "Enter author's ID #: ";
     my $id = <STDIN>;
     chomp $id;
     last if $id == 0;
     $sth->execute($id);
     while (my $row = $sth->fetchrow_hashref) {
       printf "%s %s from %s.\n",
         $row->{surname}, $row->{givenname}, $row->{city};
     }
     $sth->finish;
   }

   $dbh->disconnect;

