==>怎么从存储过程中返回某变量的值到开发程序中? 写过程,返回出参就行了。另外select s_sms_t_khdx.currval from dual;也是你要的值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢,s_sms_t_khdx.currval,我怎么就没想起来用它呢~另外怎么把一个变量返回出来啊?我是ORACLE入门者,见笑了! create or replace procedure aaa(v_id out number) asls_xlh int;beginselect s_sms_t_khdx.nextval into ls_xlh from dual;insert into sms_t_khdx(n_xlh,c_sjh,c_dxnr) values(ls_xlh,'13673377870','hello') ;--here --beginv_id := ls_xlh;--endend; 返回参数。参考Microsft的MSDN的帮助。 OracleConnection conn = new OracleConnection(); conn.ConnectionString = "Data Source=best;User ID=system;Password=manager"; conn.Open(); OracleCommand cmd =new OracleCommand(); cmd.CommandText="smsinsert(??如果传这个变量怎么得到返回的值呢??)"; cmd.CommandType=System.Data.CommandType.StoredProcedure; conn.Close(); 我不知道如何把SQL语句中的变量返回到,应用程序(c#)中啊?求哪位大哥再指点一下 create or replace procedure smsinsert(n_id out number) asls_xlh int;beginselect s_sms_t_khdx.nextval into ls_xlh from dual;insert into sms_t_khdx(n_xlh,c_sjh,c_dxnr) values(ls_xlh,'13673377870','hello') ;n_id := ls_xlh;end;--------------------------------------OracleConnection conn = new OracleConnection(); conn.ConnectionString = "Data Source=best;User ID=system;Password=manager"; conn.Open(); OracleCommand cmd =new OracleCommand();cmd.CommandText="smsinsert(??如果传这个变量怎么得到返回的值呢??)";cmd.CommandType=System.Data.CommandType.StoredProcedure;conn.Close();怎么把上面的ORACLE过程中的变量n_id返回到C#程序中呢? OleDbCommand myCommand = new OleDbCommand(); myCommand.Connection = OpenDB_Conn; OleDbParameter p1 ; //ÊÕ¼¯Èë²Î for ( int i = 0; i< inParameter.Length ;i++) { p1 = new OleDbParameter(); p1.Direction=System.Data.ParameterDirection.Input; p1.Value = (string)inParameter[i]; myCommand.Parameters.Add(p1); } //ÊÕ¼¯³ö²Î for ( int i = 0; i< outParameter.Length ;i++) { OleDbParameter p2 = new OleDbParameter("", OleDbType.VarChar,30); p2.Direction = System.Data.ParameterDirection.Output; myCommand.Parameters.Add(p2); } myCommand.CommandType = System.Data.CommandType.StoredProcedure; myCommand.CommandText = storeName; try { myCommand.ExecuteNonQuery(); //ÊÕ¼¯³ö²ÎµÄÖµ for ( int i = 0; i < outParameter.Length; i++ ) { outParameter[i] = myCommand.Parameters[i + inParameter.Length].Value.ToString(); } } 求一存储过程 这语句该怎么(最迟明早结贴) substr用法 OracleOraHome90TNSListener为什么会自动停止呢? PRO*C/C++的SQL语句问题 请问我的这个查询语句该怎么优化? oracle中怎样得到"插入的值对于列过大"究竟是哪个列? sql2000到oracle9I的错误提示,怎么解决? 如何用sql导入日期类型的数据? 为什么大家都推荐 分析(analyzes) 用10%呀? 急救:请问该存储过程错在哪里? 初学Oracle的疑问
另外怎么把一个变量返回出来啊?我是ORACLE入门者,见笑了!
ls_xlh int;
begin
select s_sms_t_khdx.nextval into ls_xlh from dual;
insert into sms_t_khdx(n_xlh,c_sjh,c_dxnr) values(ls_xlh,'13673377870','hello') ;--here
--begin
v_id := ls_xlh;
--end
end;
conn.ConnectionString = "Data Source=best;User ID=system;Password=manager";
conn.Open();
OracleCommand cmd =new OracleCommand();
cmd.CommandText="smsinsert(??如果传这个变量怎么得到返回的值呢??)";
cmd.CommandType=System.Data.CommandType.StoredProcedure;
conn.Close();
求哪位大哥再指点一下
ls_xlh int;
begin
select s_sms_t_khdx.nextval into ls_xlh from dual;
insert into sms_t_khdx(n_xlh,c_sjh,c_dxnr) values(ls_xlh,'13673377870','hello') ;
n_id := ls_xlh;
end;
--------------------------------------
OracleConnection conn = new OracleConnection();
conn.ConnectionString = "Data Source=best;User ID=system;Password=manager";
conn.Open();
OracleCommand cmd =new OracleCommand();
cmd.CommandText="smsinsert(??如果传这个变量怎么得到返回的值呢??)";
cmd.CommandType=System.Data.CommandType.StoredProcedure;
conn.Close();怎么把上面的ORACLE过程中的变量n_id返回到C#程序中呢?
myCommand.Connection = OpenDB_Conn;
OleDbParameter p1 ;
//ÊÕ¼¯Èë²Î
for ( int i = 0; i< inParameter.Length ;i++)
{
p1 = new OleDbParameter();
p1.Direction=System.Data.ParameterDirection.Input;
p1.Value = (string)inParameter[i];
myCommand.Parameters.Add(p1);
} //ÊÕ¼¯³ö²Î
for ( int i = 0; i< outParameter.Length ;i++)
{
OleDbParameter p2 = new OleDbParameter("", OleDbType.VarChar,30);
p2.Direction = System.Data.ParameterDirection.Output;
myCommand.Parameters.Add(p2);
}
myCommand.CommandType = System.Data.CommandType.StoredProcedure; myCommand.CommandText = storeName; try
{
myCommand.ExecuteNonQuery(); //ÊÕ¼¯³ö²ÎµÄÖµ
for ( int i = 0; i < outParameter.Length; i++ )
{
outParameter[i] = myCommand.Parameters[i + inParameter.Length].Value.ToString();
} }