> >    $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 } );


Thanks much. That solves the problem, although it doesn't explain
why VARCHARs are blank truncated before being bound.  Is this
just a DBI convention, or some SQL thing that I'm not aware of?  

Mark

Reply via email to