I have a VB6 program on a Win2000 box which is calling an Oracle stored procedure. The problem is that the IN/OUT parameter is returning the correct string, but with garbage on the end of the string up to the buffer size. This code was works fine with 7.3.4, but does not work with 8.1.7.
Stored Proc:
PROCEDURE get_seqkey(p_key IN OUT VARCHAR2) AS
n_key NUMBER(18);
BEGIN
SELECT abc_seq.nextval
INTO n_key
FROM DUAL;
p_key := LTRIM(TO_CHAR(n_key,'000000000000000000'));
END get_seqkey;
VB Code:
Dim cmd As New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "get_seqkey"
cmd.Parameters.Append cmd.CreateParameter("p_key", adVarChar, adParamInputOutput, 19, ""
cmd.Execute
After the execution, cmd.Parameters("p_key"
contains the proper 18 character next sequence number, plus 2 garbage characters. If I change the parm buffer size to 17, it works, but then I get an error message on the 7.3.4 version that the buffer is too small. I'd like the upgrade of this program to be independent of our oracle upgrade, if possible.
I've tried running this stored procedure from outside this VB program and it works fine.
I'm new to using ADO with VB, so please excuse me if this is something really simple. I appreciate everyone's help.
Stored Proc:
PROCEDURE get_seqkey(p_key IN OUT VARCHAR2) AS
n_key NUMBER(18);
BEGIN
SELECT abc_seq.nextval
INTO n_key
FROM DUAL;
p_key := LTRIM(TO_CHAR(n_key,'000000000000000000'));
END get_seqkey;
VB Code:
Dim cmd As New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "get_seqkey"
cmd.Parameters.Append cmd.CreateParameter("p_key", adVarChar, adParamInputOutput, 19, ""
cmd.Execute
After the execution, cmd.Parameters("p_key"
I've tried running this stored procedure from outside this VB program and it works fine.
I'm new to using ADO with VB, so please excuse me if this is something really simple. I appreciate everyone's help.