Re: oracle RAW data type and dbi



On 2008-02-13 11:25, Heinrich Mislik <Heinrich.Mislik@xxxxxxxxxxxx> wrote:
In article <fosetf024fq@xxxxxxxxxxxxxxx>, dcruncher4@xxxxxxx says...
we are storing binary data in an oracle table as RAW data type. Oracle
converts RAW data type into hex values at the time of storing.

No. It converts the raw value to hex when you *read* it into a character
variable.

When I view the data thru sqlplus I see it as hex.

That's because sqlplus reads all columns as character types (it has to
print them, after all).


Obviously it has to be converted back to original value when we fetch it.
It seems it is not happening.

use DBD::Oracle qw(:ora_types);
$o_sth->bind_col(1,\$binvalue,{ ora_type => ORA_RAW } ) ;

when I do print $binvalue, I see it as hex only? Why?
Curiously Pro-C converts that to original form.

perldoc DBD::Oralce does not mention bin_col anywhere. It seems, that
ora_types can only be used with bin_param.

perldoc DBI does specifically mention { ora_type => 97 } as an example
for a driver-specific attribute for bind_col.

However, it also says that the second parameter can be undef, which
doesn't seem to work, either:

Can't DBI::st=HASH(0xa5d52e0)->bind_col(2, undef,...), need a reference
to a scalar at ./raw_test line 23.

so it's probably not quite up to date.

hp

.



Relevant Pages