Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There is a code for getting next value of a s sequence by sequence name?
public int GetNextVal(String seqname)
{
???
}

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

Thanks.
Posted
Updated 23-Jan-12 19:54pm
v2

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
 
Share this answer
 
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:

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


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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900