On Mon, 26 Aug 2002 19:38:05 -0700 Mark Dedlow <[EMAIL PROTECTED]> wrote:
> Using oracle 8.1.7, perl 5.6.1, DBD::Oracle 1.12.
>
> When I do an insert like this below on CT.COL, a varchar2(10):
>
> $c = $dbh->prepare( 'insert into ct (COL) values (?)');
> $c->execute('bind ');
>
> The trailing blank doesn't make it to the db. Doing the functional
> equivalent using native oracle tools works correctly.
>
> Anyone know where this problem lies?
It's because DBD::Oracle passes strings as VARCHAR by default. Add the
following to your script:
# Near top
use DBD::Oracle qw( :ora_types );
# After prepare()
# This only needs to be done once per prepare,
# to tell DBI what type the parameter is.
# You can pass the actual values via execute(), if you want.
$c -> bind_param( 1, 'bind ', { "ora_type" => ORA_CHAR } );
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.