这个在数据库中可以执行?为什么?

C#
OracleParameter p1 = new OracleParameter("t1", OracleType.VarChar);
OracleParameter p2 = new OracleParameter("t2", OracleType.Number);
OracleParameter p3 = new OracleParameter("t3", OracleType.VarChar,20);
OracleParameter p4 = new OracleParameter("t4", OracleType.Number);
OracleParameter p5 = new OracleParameter("t5", OracleType.Number);
OracleParameter p6 = new OracleParameter("t6", OracleType.Number);
OracleParameter p7 = new OracleParameter("t7", OracleType.Number);
p1.Direction = ParameterDirection.Input;
p2.Direction = ParameterDirection.Input;
p3.Direction = ParameterDirection.Output;
p4.Direction = ParameterDirection.Output;
p5.Direction = ParameterDirection.Output;
p6.Direction = ParameterDirection.Output;
p7.Direction = ParameterDirection.Output;

p1.Value = "1234"; p2.Value = 1;
OracleConnection conn = new OracleConnection(@"Data Source=XXX;Password=XXX;User ID=XXX");
conn.Open();
OracleCommand testCommand = conn.CreateCommand();
testCommand.CommandText = "abc.bcd";
testCommand.CommandType = CommandType.StoredProcedure;

testCommand.Parameters.Add(p1);
testCommand.Parameters.Add(p2);
testCommand.Parameters.Add(p3);
testCommand.Parameters.Add(p4);
testCommand.Parameters.Add(p5);
testCommand.Parameters.Add(p6);
testCommand.Parameters.Add(p7);
OracleDataAdapter daHIS = new OracleDataAdapter();
daHIS.SelectCommand = testCommand;
DataSet ds = new DataSet();
daHIS.Fill(ds);
conn.Close();

create or replace procedure abc.bcd(t1 in varchar2,t2 in number,t3 out varchar2 ,t4 out number,t5 out number , t6out number ,t7 out number )

declare
t3 varchar2(20);
t4 number;
t5 number;
t6 number;
t7 number;

begin
inpbill.fetch_inp_fee('123', 1, t3, t4, t4, t5, t7);
end;

万千封印
浏览 101回答 2
2回答

慕容708150

create or replace procedure abc.bcd(t1 in varchar2,t2 in number,t3 out varchar2 ,t4 out number,t5 out number , t6out number ,t7 out number )/* 这部分要注释掉,你的参数是传入的,这里不能重复申明declaret3 varchar2(20);t4 number;t5 number;t6 number;t7 number;*/begininpbill.fetch_inp_fee('123', 1, t3, t4, t4, t5, t7);end;

白衣非少年

将存储过程create or replace procedure abc.bcd(t1 in varchar2,t2 in number,t3 inout varchar2 ,t4 inout number,t5 inout number , t6 inout number ,t7 inout number )t3、t4、t5、t6、t7都定义成inout类型。在存储过程当中定义out类型,是传不去值的,而你还想要向其中传值,只能定义成inout型。
打开App,查看更多内容
随时随地看视频慕课网APP