I don't know if this is DBI or DBD::Oracle's fault, but it is _very_ annoying!

Given that I have to write perl scripts that work on different type of
databases, and that we chose to only use lowercase table and field names, and
given the fact the Oracle is so stupid to return uppercase everywhere, I
thankfully use the FetchHashKeyName => "NAME_lc" attribute


--8<---
#!/pro/bin/perl

use strict;
use warnings;

use DBI;

my ($dbu, $dbp) = split "/" => $ENV{ORACLE_USERID};

my %attr = (
    RaiseError         => 1,
    PrintError         => 1,
    AutoCommit         => 0,
    ChopBlanks         => 1,
    ShowErrorStatement => 1,
    FetchHashKeyName   => "NAME_lc",
    );

my $dbh = DBI->connect ("DBI:Oracle:", $dbu, $dbp, \%attr) or die "connect: $!";

my $sth = $dbh->prepare ("select * from parm where 0 = 1");
$sth->execute;

my @name = @{$sth->{NAME}};

print "NAME: @name\n";

$sth->finish;
$dbh->disconnect;
-->8---

lep a5:/tmp 118 > describe parm
Table                        Field                N    Type
---------------------------- -------------------- - ---------------------------
PROLEP.parm                  parm                 N 12:varchar2 (16)
PROLEP.parm                  c_usr                N  3:numeric (9)
PROLEP.parm                  waarde                  3:numeric (9)
PROLEP.parm                  omschr                 12:varchar2 (50)
lep a5:/tmp 119 > perl dbi.pl
NAME: PARM C_USR WAARDE OMSCHR
lep a5:/tmp 120 >

D'uh!!!!!

Do you understand why I *hate* Oracle?

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.024 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/

Reply via email to