获取下一个序列值 [英] Get next sequence value

查看:193
本文介绍了获取下一个序列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个代码可以通过序列名称获取s序列的下一个值吗?

There is a code for getting next value of a s sequence by sequence name?

public int GetNextVal(String seqname)
{
???
}


如果seq不存在,则返回-1?

谢谢.


And if seq doesn''t not exist return -1?

Thanks.

推荐答案

您在这里迷失了序列的概念,我的朋友.您的函数仅包含整数序列,如果您只需要整数,就可以了,但是最令人不安的是,您的函数仅采用序列名称,而没有第二个参数,这对于确定变量的最后状态是非常必要的.有问题的顺序.
要提及的另一件事是,存在所有可能的序列,而不仅仅是最后一个上一个值,就需要确定所述序列的下一个值.

请随时完善您的问题,以便我们的解决方案在任何方面都将真正有帮助.

问候,
Manfred
You''re missing out on the concept of sequences here my friend. Your function only covers sequences of integers which is ok if that is all you are after, but most disturbing is the fact that your function only takes a sequence name and no second parameter which would be very much in demand to ascertain the last status of the sequence in question.
Another thing to mention is the fact that there are all kinds of conceivable sequences that would require more than just the last previous value to determine the next value of said sequence.

Please feel free to refine your question so that our solutions will be in any way truely helpful.

Regards,
Manfred


您正在谈论某种类型的List?也许LinkedList

您可能需要阅读:关于收藏的教程 @ oracle.com [
you are talking about some type of List? maybe LinkedList

You might want to read: Tutorial on Collections@ oracle.com [^]

You can also rush through there with a foreach loop:

for (int i: oList){
  System.out.println("List entry\t" + i);
}



还是进行诸如"select nextVal('''')"之类的查询是数据库的事情?



Or is it more a database thing to make a query like "select nextVal('''')" ???


这篇关于获取下一个序列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆