c# - ado.net oracle stored procedure output varchar parameter split-cut-truncated -
i have oracle-stored procedure (sp) returns varchar
parameter, when execute sp , seek read output, string cut. when execute sp on toad , made dbms.output
, string returned.
procedure teststringoutput(num in number, str out varchar2) v_c number(38); v_e varchar2(2000); begin select '12345678910111213141516171819ppppppppppppppppppppppppp' str dual; exception when others v_c := sqlcode; v_e:= sqlerrm; dbms_output.put_line(v_c||'-> '||v_e); end;
the way phone call sp script:
declare p2 varchar2(2000) :=''; begin pkgtest.teststringoutput(1,p2); dbms_output.put_line('output string - > '||p2); end;
the output:
output string - > 12345678910111213141516171819ppppppppppppppppppppppppp
the way sp called c#:
public void testoutputstring() { string str = string.empty; using (connection) { oraclecommand objcmd = new oraclecommand(); objcmd.connection = connection; objcmd.commandtext = "pkgtest.teststringoutput"; objcmd.commandtype = commandtype.storedprocedure; objcmd.parameters.add("num", oracletype.number).value = 0; objcmd.parameters.add("str", oracletype.varchar, 2000).direction = parameterdirection.output; foreach (oracleparameter parameter in objcmd.parameters) if (parameter.value == null) parameter.value = dbnull.value; seek { connection.open(); objcmd.executenonquery(); str = (objcmd.parameters["str"].value.tostring()); } grab (exception ex) { throw new exception(ex.message); } connection.close(); } }
but when inspect response string, split until 123456789101112131415161718
, part (19ppppppppppppppppppppppppp
) lost. see image.
what doing wrong?
update: i'm sure happened, sp's homecoming messages wcf service, when client received response, split.
finally have utilize oracle info provider odp.net instead of ado.net - system.data.oracleclient (deprecated) , works.
c# oracle stored-procedures ado.net
No comments:
Post a Comment