On Mon, Jun 09, 2003 at 09:30:48AM +0200, deadtwoU wishUknew wrote:
> Gooday fine people?
> 
> Has anyone here successfully managed to get SQL DECODE to
> work with perl DBI using Oracle as a db backend. I keep
> getting the same error continously...
> "$h-<rows count is incomplete before all rows fetched"
> Whether this result from the use of DECODE or not I don't
> know....but it seems DECODE does not work at all...can
> anyone vouch for this? 

You seem to have this unwavering superstition about DECODE.  I guarantee
you, there are no problems using DECODE through DBI.  Any problems you are
experiencing are unrelated to DECODE.

DBI doesn't even care about DECODE.  It passes off some SQL to Oracle, and
gets some results back.  DBI has to deal with placeholders, but other than
that, it does not matter to DBI what is in the SQL.

 
> Now, I read a bit bout this, and in the DBI draft it states
> that row count may be incomplete due to oracle's read-ahead
> cache...*hmm* 
> 
> Anyone can explain that to me,

Oracle doesn't know how many rows it will find until it has returned them
all, because it can start returning rows before it has found them all.


> or possibly provide a working example of how to cure this, and possibly a
> working eg. of use of DECODE within perl DBI :)

This will select myid and mycol from mytable, and when mycol is NULL, it
will return '?' instead of undef:

$sth->prepare(<<"EndOfSQL");
  SELECT myid, DECODE(mycol, NULL, '?', mycol)
  FROM   mytable
EndOfSQL


Ronald

Reply via email to