I am not getting blanks chopped off of the end of a CHAR parameter returned
from a proc when I set the attribute ChopBlanks => 1. I've included an example
PL/SQL procedure and perl script that illustrates this:
PROCEDURE test_char_return_values (po_return_code OUT PLS_INTEGER,
po_return_string OUT VARCHAR2,
charval OUT CHAR
);
END jdh_test_pkg;
/
SHOW ERRORS;
/
CREATE OR REPLACE PACKAGE BODY jdh_test_pkg IS
PROCEDURE test_char_return_values (po_return_code OUT PLS_INTEGER,
po_return_string OUT VARCHAR2,
charval OUT CHAR
) IS
BEGIN
po_return_code := 1;
po_return_string := '';
charval := 'X';
END;
END jdh_test_pkg;
/
SHOW ERRORS;
/
#!/usr/bin/perl
use DBI;
use DBD::Oracle qw(:ora_types);
$dbo = DBI->connect('DBI:Oracle:db', 'username', 'passwd',
{AutoCommit => 0, LongReadLen => 32767, LongTruncOk => 1,
ChopBlanks => 1});
my $errNo=0;
my $errStr='';
my $charval='';
$sth=$dbo->prepare("BEGIN INTRALECT.jdh_test_pkg.test_char_return_values(".
" ?, ?, ?); END;");
$sth->bind_param_inout(1, \$errNo, 255);
$sth->bind_param_inout(2, \$errStr, 255);
$sth->bind_param_inout(3, \$charval, 1);
$sth->execute();
print "'$charval'\n";
OUTPUT:
'X '
How can I get rid of those pesky blanks inside DBD::Oracle!?!?
(And yes, I know VARCHAR2 is preferred over CHAR in Oracle, but I don't have
much say in specifying the procs I have to use.)
Thanks,
Jeff Horn