Sorry this is posted in a few places - I'm new and trying to find the right forum for this problem.
I have a VB6 program that 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 had been working fine with oracle 7.3.4, but started giving garbage when tried with 8.1.7.
Stored Proc:
VB Code:
I've tried assigning cmd.Parameters("p_key"
to both a string and a variant and get the same thing. The variable contains the proper 18 character sequence number, plus 2 garbage characters. If I change the parm buffer size to 17, it works with 8.1.7, but then I get an error message on the 7.3.4 version that the buffer is too small. I'd like 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 also tried this with another oracle stored procedure that generates sysdate string and get the same result - garbage at the end of the string up to the buffer length. I would appreciate any help you can give me.
I have a VB6 program that 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 had been working fine with oracle 7.3.4, but started giving garbage when tried with 8.1.7.
Stored Proc:
Code:
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:
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
I've tried assigning cmd.Parameters("p_key"
I've tried running this stored procedure from outside this VB program and it works fine. I also tried this with another oracle stored procedure that generates sysdate string and get the same result - garbage at the end of the string up to the buffer length. I would appreciate any help you can give me.