Problem with parameters when using packages and unicode = true
Posted: Tue 17 Apr 2007 14:56
My problem is that it seems as if the parameters are getting corrupted with extra characters when i am using unicode = true.
Create the following package and table
CREATE OR REPLACE PACKAGE PKG_PARAM_TEST IS
procedure proc_test(
v_name IN varchar2,
v_category IN varchar2,
v_query OUT varchar2,
v_description OUT varchar2);
procedure proc_test2(
v_name IN varchar2,
v_category IN varchar2);
END PKG_PARAM_TEST
;
CREATE OR REPLACE PACKAGE BODY PKG_PARAM_TEST AS
procedure proc_test(
v_name IN varchar2,
v_category IN varchar2,
v_query OUT varchar2,
v_description OUT varchar2)
as
begin
insert into logs logtext values (v_category);
end proc_test;
procedure proc_test2(
v_name IN varchar2,
v_category IN varchar2)
as
begin
insert into logs logtext values (v_category);
end proc_test2;
END PKG_PARAM_TEST;
create table LOGS
(
LOGTEXT VARCHAR2(4000)
);
then when using this code:
private void button4_Click(object sender, EventArgs e)
{
OracleConnection oc = new OracleConnection();
oc.Unicode = true;
oc.Server = "development";
oc.UserId = "main";
oc.Password = "main";
oc.Open();
OracleCommand o = new OracleCommand();
o.Connection = oc;
o.ParameterCheck = true;
o.CommandType = CommandType.StoredProcedure;
o.CommandText = "pkg_param_test.proc_test";
o.Prepare();
o.Parameters["v_name"].Value = "1111";
o.Parameters["v_category"].Value = "2222";
o.ExecuteNonQuery();
MessageBox.Show("completed ok");
}
i get 5 characters inserted into the table, where the last character is unprintable.
if i call pkg_param_test.proc_test2 which differs only in its parameters, it works fine. It also works fine when unicode = false.
This is using OraDirect 3.55.17.0 with direct = false and Oracle 9i 9.2.0.8.0 and our database is configured to use the UTF8 character set.
Any help would be most appreciated.
Create the following package and table
CREATE OR REPLACE PACKAGE PKG_PARAM_TEST IS
procedure proc_test(
v_name IN varchar2,
v_category IN varchar2,
v_query OUT varchar2,
v_description OUT varchar2);
procedure proc_test2(
v_name IN varchar2,
v_category IN varchar2);
END PKG_PARAM_TEST
;
CREATE OR REPLACE PACKAGE BODY PKG_PARAM_TEST AS
procedure proc_test(
v_name IN varchar2,
v_category IN varchar2,
v_query OUT varchar2,
v_description OUT varchar2)
as
begin
insert into logs logtext values (v_category);
end proc_test;
procedure proc_test2(
v_name IN varchar2,
v_category IN varchar2)
as
begin
insert into logs logtext values (v_category);
end proc_test2;
END PKG_PARAM_TEST;
create table LOGS
(
LOGTEXT VARCHAR2(4000)
);
then when using this code:
private void button4_Click(object sender, EventArgs e)
{
OracleConnection oc = new OracleConnection();
oc.Unicode = true;
oc.Server = "development";
oc.UserId = "main";
oc.Password = "main";
oc.Open();
OracleCommand o = new OracleCommand();
o.Connection = oc;
o.ParameterCheck = true;
o.CommandType = CommandType.StoredProcedure;
o.CommandText = "pkg_param_test.proc_test";
o.Prepare();
o.Parameters["v_name"].Value = "1111";
o.Parameters["v_category"].Value = "2222";
o.ExecuteNonQuery();
MessageBox.Show("completed ok");
}
i get 5 characters inserted into the table, where the last character is unprintable.
if i call pkg_param_test.proc_test2 which differs only in its parameters, it works fine. It also works fine when unicode = false.
This is using OraDirect 3.55.17.0 with direct = false and Oracle 9i 9.2.0.8.0 and our database is configured to use the UTF8 character set.
Any help would be most appreciated.