xs2praveen has asked for the wisdom of the Perl Monks concerning the following question:

I have Oracle 10g installed on linux machine.Oracle has shipped the perl version 5.8.3 but I have one more version 5.8.0 on my machine. On selecting a varchar column of some table using 5.8.0 perl gives segmentation fault whereas it works fine with the version 5.8.3. But if i select the number column of the same table,both the versions work fine. here is the code snippet:
use strict; use DBI; my $id=41; my $twotask=$ENV{"TWO_TASK"}; my $dsn="dbi:Oracle:".$twotask; my $DBH=DBI->connect("$dsn",'hr','hr') or die "error \n".DBI->errstr; my $stmt="select varchar_column from temp where id=?"; my $sth=$DBH->prepare($stmt); $sth->execute($id)||die "Could not exec sql stmt\n"; my @row=$sth->fetchrow_array; print $row[0];
this dumps core with 5.8.0 but works fine with 5.8.3. if i change the query to "select number_column from temp where id=?" both versions work fine. Any help regarding this issue?

Replies are listed 'Best First'.
Re: Perl DBI issue
by tirwhan (Abbot) on Jul 03, 2007 at 12:23 UTC

    Umm, use the 5.8.3 version or (vastly better) upgrade your local Perl installation to a current version? Seriously, 5.8.0 is now almost 5 years old, in computing that's almost ancient, and numerous bugs have been fixed since then. Bite the bullet and upgrade (and use a cluestick to beat sensible any sysadmin who wants to stand in your way).


    All dogma is stupid.
Re: Perl DBI issue
by rir (Vicar) on Jul 03, 2007 at 13:37 UTC
    No guarantees, I've never used Oracle.

    This might just be a type issue, you could look at using something like:

    $sth->bind_param( 1, $s->{fed_id}, {TYPE => DBI::SQL_VARCHAR} );
    to get Perl and your DB to agree on the type of the parameter. You query your Oracle driver to get the list of all valid types; I think the magic word on which to search the DBI docs is "SQL_TYPE" but I'm not sure.

    Be well,
    rir