[Bioperl-l] DB2 driver for BioPerl

Florian Mittag florian.mittag at uni-tuebingen.de
Thu Aug 6 14:12:21 UTC 2009


On Thursday, 6. August 2009 15:42, Hilmar Lapp wrote:
> On Aug 6, 2009, at 5:38 AM, Florian Mittag wrote:
> > Is there a way to change the "NULL" to "cast(NULL as VARCHAR(255))"
> > only when the driver is DB2?
>
> Not yet, but that's the solution I had in mind, i.e., introducing a
> method in the Bio::DB::DBI::* (driver-specific) classes that returns
> whatever NULL as a SELECT field should be represented as.

Sounds like a good idea!


> What will be 
> very hard or nearly impossible to do is to cast to the actual type of
> the column, so if simply using VARCHAR(255) does the trick for DB2
> that'd be great. <sigh/>

Surprisingly, it does. At least, I haven't noticed any problems if the target 
data type is for example an integer. With all the trouble I have with DB2, I 
didn't expect this.


> BTW you did check that simply aliasing the column does not fix the
> problem for DB2, right? I.e., "SELECT NULL AS col1 FROM bioentry" will
> throw an error, right?

Yepp:

SELECT term.term_id, term.identifier, term.name, term.definition, 
term.is_obsolete, NULL AS col1, term.ontology_id FROM term WHERE identifier 
= ?

[IBM][CLI Driver][DB2/LINUX] SQL0418N  A statement contains a use of an 
untyped parameter marker or a null value that is not valid.


- Florian



More information about the Bioperl-l mailing list