public long getId(string spIdGen)
{
this.Comd.CommandType = CommandType.StoredProcedure;
this.Comd.CommandText = "spIdGen";
this.Comd.Parameters.Add(new SqlParameter("@id",SqlType.int,0,ParameterDirection.Output,false,0,0,"ID",DataRowVersion.Default,null));
this.Conn.Open();
this.Comd.ExecuteNonQuery();
long id = (long) this.Comd.Parameters["@id"].Value;
this.Comd.Parameters.Clear();
this.Comd.CommandType = CommandType.Text;
this.Conn.Close();
return id;
}
原来用的是SQLserver数据库
所用存储过程如下:
create procedure spIdGen @id bigint output as
begin
update ZB_ID_GEN set ID = ID + 1, @id = ID + 1;
endGO
现在我要将存储过程改成是oracle中的update语句我应该怎么改上面的那段代码以及如何将上面的那段存储过程改为update语句
{
this.Comd.CommandType = CommandType.StoredProcedure;
this.Comd.CommandText = "spIdGen";
this.Comd.Parameters.Add(new SqlParameter("@id",SqlType.int,0,ParameterDirection.Output,false,0,0,"ID",DataRowVersion.Default,null));
this.Conn.Open();
this.Comd.ExecuteNonQuery();
long id = (long) this.Comd.Parameters["@id"].Value;
this.Comd.Parameters.Clear();
this.Comd.CommandType = CommandType.Text;
this.Conn.Close();
return id;
}
原来用的是SQLserver数据库
所用存储过程如下:
create procedure spIdGen @id bigint output as
begin
update ZB_ID_GEN set ID = ID + 1, @id = ID + 1;
endGO
现在我要将存储过程改成是oracle中的update语句我应该怎么改上面的那段代码以及如何将上面的那段存储过程改为update语句
oracle没用过,但是知道一点,跟SQL的差别不是很大,SQL里面是这样的:
create procedure spIdGen
(
@id bigint output
)
as
begin
update ZB_ID_GEN set ID = ID + 1, @id = ID + 1 where ...
end
你这里面怎么没有定义ID?
各位高手再帮帮忙吧
改改呀