今天用了一下oracle,写了个语句不知道怎么获取结果,各位帮忙看看:
string strCommand = "
begin declare t number(6); begin insert into DepartmentAnnounce(id,Title,Content) values(Departmentannounce_Sequence.nextval,:Title); select Departmentannounce_Sequence.currval into t from dual; end;end;";那个into t是后加上去的,不太明白为什么一定要这个into clause?
本以为这样可以返回结果:
                con = new OracleConnection(connectionString);
                con.Open();
                OracleCommand command = new OracleCommand(context, con);
                add(command);//一个委托,用于添加参数的
                return command.ExecuteOracleScalar();
可是结果为0.
各位看看哪里有问题呢?应该怎样做才能得到那个值(t)?谢谢了!