Hi,
When I call a stored procedure, which has a CHAR or VARCHAR as OUT-Parameter, this parameter is truncated:
My Stored Procedure:
--------------
CREATE PROCEDURE TEST_VARCHAR_OUT (
out test_out1 VARCHAR(1)
,out test_out2_safe VARCHAR(2)
,out test_out5 VARCHAR(5)
,out test_out6_safe VARCHAR(6)
,out test_char1 CHAR(2)
)
LANGUAGE SQL
BEGIN
SET test_out5 = 'ABCDE';
SET test_out6_safe = 'ABCDE';
SET test_out1 = 'A';
SET test_out2_safe = 'A';
SET test_char1 = 'AB';
RETURN 0;
END
@
--------------
In Python:
>>> params = ("","","","","")
>>> import ibm_db
>>> conn = ibm_db.connect(db_name, db_user, db_pwd )
>>> ibm_db.callproc(conn, "TEST_VARCHAR_OUT", params)[1:]
('', 'A', 'ABCD', 'ABCDE', 'A')
This means, that every string is truncated by one character.
When I use other parameters, with one more character as the parameter is defined (reserving perhaps enough length to the pointer in C) it is working, like it should:
>>> params = (" "*2," "*3," "*6," "*7," "*3)
>>> ibm_db.callproc(conn, "TEST_VARCHAR_OUT", params)[1:]
('A', 'A', 'ABCDE', 'ABCDE', 'AB')
------
Can somebody confirm this behaviour or am I doing this in a not proper way?
I am working on WinXP 32 and Server is running on a linux-machine.
Python 2.6.6
IBM_DB 1.0.5
Thank you!