Newsgroup: it.comp.lang.perl
Titolo: Problem to access BLOB field in a Oracle DB

Hello gents
I have a strange problem on a perl application that read lob date from a 
oracle DB 8.1.6
The application work fine on sun solaris with perl 5.5 and Oracle 8.1.6
but the same application have a problem on Windows 2000 with perl 5.6.1 
and oracle 8.1.6
Whe i try to read the blob from the db i receve the follow error "
DBD::Oracle::st execute failed ORA-00932: incosisten datatypes (DBD: 
oexfet error e.g. can't select LOB fields using DBD::Oracle built for 
Oracle 7) at xxxx line yyyy
I user ActivePerl binary build 633 provide by activestate corp built 
21:33:05 Jun 17 2002
The module DBD::Oracle is version 1.12
The module DBI is version 1.27
Follow a peace of code
-----------------------------------------------------------------------------------------
Open the DB
   $DBH = DBI->connect( "dbi:Oracle:$ORACLE_ISTANCE",
                                    $ORACLE_USERNAME,
                                    $ORACLE_PASSWORD,
                                    { AutoCommit => 0, RaiseError => 1, 
PrintError => 0 ,LongReadLen=> 512000 } )
Read the blob
     my $select = "D.LOBLOC";
     my $from   = "COMPLEXCONTENT A, HOLDERTOCONTENT B , APPLICATIONDATA 
C, STREAMDATA D";
     my $where  = "A.IDA2A2= $ida2a2 AND A.IDA2A2= B.IDA3A5 AND 
B.IDA3B5= C.IDA2A2 AND C.IDA3A5=D.IDA2A2";
     my $cm     = "SELECT $select FROM $from WHERE  $where";
     my $sth = $DBH->prepare($cm);
     $sth->execute;	<----- where the error appears
Someone can help me about this problem , how i can solve it ?
Thanks for the support
Regards LAGO

Alesandro,
The problem is pretty explicit in the error message (i.e. "(DBD: oexfet 
error e.g. can't select LOB fields using DBD::Oracle built for Oracle 7)").
Have you read DBD::Oracle docs?  See the section "Handling LOBs"
<guess>
I believe the problem is your LongReadLen size.  I would try making it 
smaller and see what happens.  You might also want to watch out for 
truncation of the LOB column when doing this.
If this fails, I think you are out of luck.  DBD::Oracle v1.12 is the 
latest version on ASs site and it looks like they built it on Oracle v7. 
  Your only recourses at this point are:
1.  Ask AS to make a DBD::Oracle for Oracle 8i.
2.  Try and make your own version of Perl for Windows.
3.  Go back to Solaris or some othe *nix platform.
</guess>
Good luck.
--
Ron Reidy
Oracle DBA


 21:33:05 Jun 17 2002
e cioe`: (a) potrebbe aver ricompilato il driver DBD:Oracle con una 
versione di libreria superiore, e quindi ti sarebe sufficiente 
scaricarlo ed installarlo mediante lo strumento PPM o (b) potrebbe 
essere rimasto tutto cosi` com'e`, costringendoti a ricompilare il 
driver per tuo conto, il che richiede il Visual C++, le librerie Oracle 
e tante altre rogne.
   Un'alternativa, che ti potrebbe costare veramente un minimo di 
riscrittura di codice (ed in questo caso benediresti l'architettura 
DBI/DBD), e` quella di spostarti dall'accesso diretto DBD:Oracle a 
quello mediato dall'ODBC: e` presumibile che tu abbia a disposizione i 
driver ODBC per la versione in uso di Oracle... sempre che supportino il 
dominio BLOB in modo efficiente.
-- 
Alla prossima,
Marco