Stephen Carville wrote:
On Tuesday 27 January 2009 08:55, Martin Evans wrote:
Stephen Carville wrote:
On Tuesday 27 January 2009 07:21, Martin Evans wrote:
Does anyone know of a way to get numbers (as I've described) back from
DBD::Oracle.
If you know the data is integer try:
while($s->fetch) {
push @data, int($num);
etc()
}
I do know it is an integer but so does DBD::Oracle and Oracle. I was
hoping to avoid doing int($x) or $x+0 or $x*1 etc etc everywhere I had
an integer, especially since a lot of the code uses fetchall_arrayref
which means looping though all rows and integer columns changing them or
changing the code to loop on fetch. I guess I don't see why a known
integer cannot look like an integer once retrieved without me manually
changing it.
OK, I see your issue better. Did you try
$s->bind_col(1, \$num, {ora_type => ORA_NUMBER});
instead of ORA_LONG?
yes, that was a mistake (I use ODBC a lot and LONG is an integer in
ODBC), I pasted in an early version and in fact I was already using
ORA_NUMBER. It makes no difference.
If worse comes to worst and you know the position of the miscreant data, you
could use map() to change the columns.
@data[0,2] = map(int,@data[0,2]);
That doesn't cure the underlying problem but will let you use
fetchall_arrayref().
Thanks, that is pretty much what I'm doing now.
If any other DBDs do something special for integers please let me know
as I'm thinking of looking at this for DBD::ODBC too.
Martin
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com