I'm not sure, but isn't a char(8) always '12345 ', in Oracle?
oh well,
$dbh->{ora_ph_type} = 96; or
$sth->bind_param(1, $fld, {ora_type =>96});
will work for sure......well they should :-)
On 12-Jun-01 Wilson, Doug wrote:
> Well, we know it SHOULD work, but ya never know till you try :)
>
> Just trying to narrow down the problem.
> or match '12345 %'?
> What if the value stored is '12345<null><null><null>'
>
> -----Original Message-----
> From: Scott T. Hildreth [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 12, 2001 3:04 PM
> To: Doug
> Cc: [EMAIL PROTECTED]; Rick Osterberg
> Subject: RE: Strange CHAR/Oracle/DBI issue
>
>
>
> like would work, but it will match '123456' as well as '12345 '.
>
> On 12-Jun-01 Scott T. Hildreth wrote:
>>
>> DBD::Oracle trims the trailing spaces by default.
>> try this select * from bar where bar = rpad(?, 8).
>>
>> or
>>
>> use DBI;
>> use DBD::Oracle qw(:ora_types);
>>
>> my $dbh = DBI->connect( "dbi:Oracle:", "user/passwd", "",
>> {RaiseError => 1} ) or die $DBI::errstr;
>>
>> $dbh->{ora_ph_type} = 96;
>>
>>
>> On 12-Jun-01 Rick Osterberg wrote:
>>> Nope -- doesn't work either. (I had neglected to mention... we had tried
>>> that, too.)
>>>
>>> -Rick
>>>
>>> On Tue, 12 Jun 2001, Wilson, Doug wrote:
>>>
>>>> Maybe it is binding as a number. Try:
>>>> $sth->bind_param(1, $value, { TYPE => SQL_CHAR });
>>>> before the execute instead of putting $value in the execute;
>>>>
>>>> -----Original Message-----
>>>> From: Rick Osterberg [mailto:[EMAIL PROTECTED]]
>>>> Sent: Tuesday, June 12, 2001 2:04 PM
>>>> To: '[EMAIL PROTECTED]'
>>>> Subject: Strange CHAR/Oracle/DBI issue
>>>>
>>>>
>>>> Strange one here to pass by everyone:
>>>>
>>>> Oracle 8.0.5.1.1 server
>>>> Perl 5.00503 (on both alpha-dec_osf and Solaris)
>>>> DBI 1.14
>>>>
>>>> Take an Oracle table FOO, with a single field BAR which is a CHAR(8).
>>>> Most everything in that field BAR is 8-characters long, but there are a
>>>> couple that are 5 characters long.
>>>>
>>>> In SQLPLUS, I can do:
>>>>
>>>> SQL> SELECT COUNT(*) FROM FOO WHERE BAR = '12345';
>>>> or
>>>> SQL> SELECT COUNT(*) FROM FOO WHERE BAR = '12345 ';
>>>>
>>>> Both work, and give the correct value.
>>>>
>>>> However, from Perl/DBI:
>>>>
>>>> $sql = "SELECT COUNT(*) FROM FOO WHERE BAR = ?";
>>>> $sth = $dbh->prepare($sql);
>>>> $value = '12345';
>>>> $sth->execute($value);
>>>> ($result) = $sth->fetchrow_array();
>>>>
>>>> The $result is always zero, which is incorrect. Stays like that even if
> I
>>>> change
>>>>
>>>> $value = '12345';
>>>> to
>>>> $value = '12345 ';
>>>>
>>>> What am I missing?
>>>>
>>>> -Rick
>>>>
>>>>
> +--------------------------------------------------------------------------+
>>>> | Rick Osterberg [EMAIL PROTECTED]
>
>>>> | |
>>>> | Database Applications Specialist FAS Computer Services
>
>>>> | |
>>>>
> +--------------------------------------------------------------------------+
>>>>
>>>
>>>
> +--------------------------------------------------------------------------+
>>>| Rick Osterberg [EMAIL PROTECTED]
>|
>>>| Database Applications Specialist FAS Computer Services
>|
>>>
> +--------------------------------------------------------------------------+
>>>
>>
>> ----------------------------------
>> E-Mail: Scott T. Hildreth <[EMAIL PROTECTED]>
>> Date: 12-Jun-01
>> Time: 16:43:41
>> ----------------------------------
>
> ----------------------------------
> E-Mail: Scott T. Hildreth <[EMAIL PROTECTED]>
> Date: 12-Jun-01
> Time: 17:03:14
> ----------------------------------
----------------------------------
E-Mail: Scott T. Hildreth <[EMAIL PROTECTED]>
Date: 12-Jun-01
Time: 17:19:48
----------------------------------