|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.db.jdbc.oracle.Sequence
A Sequence object is a wrapper for Oracle sequences.
This example shows how to create, use, and drop a Sequence that starts at 10 and is incremented by 1.
// Create a Sequence that starts at 10 and is incremented by 1. Sequence.create(conn, "seq1", 10, 1);For implementation and usage, see the dbKona Developers Guide.
Sequence seq = new Sequence(conn, "seq1");
// Generate 10 numbers from Sequence for (int i = 0; i < 10; i++) System.out.println("Next value = " + seq.nextValue());
// Print last value of Sequence System.out.println("Current value of sequence is: " + seq.currentValue());
// Drop the Sequence Sequence.drop(conn, "seq1");
Constructor Summary | |
Sequence(java.sql.Connection conn,
java.lang.String seqname)
Constructs a Sequence with the specified JDBC Connection. |
Method Summary | |
void |
close()
Closes a Sequence and frees its resources. |
java.sql.Connection |
connection()
Returns the Connection associated with a Sequence. |
static void |
create(java.sql.Connection conn,
java.lang.String seqname,
int increment,
int start)
Creates a sequence of the specified name on an Oracle server with the specified start value and increment value. |
int |
currentValue()
Returns the current value of a Sequence object. |
static void |
drop(java.sql.Connection conn,
java.lang.String seqname)
Drops a sequence from an Oracle server. |
java.lang.String |
name()
Returns the name of the Oracle sequence that is associated with a Sequence object. |
int |
nextValue()
Returns the next value of a Sequence. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Sequence(java.sql.Connection conn, java.lang.String seqname) throws java.sql.SQLException, DataSetException
conn
- java.sql.Connection objectseqname
- Name of an Oracle sequence that existsMethod Detail |
public void close() throws java.sql.SQLException, DataSetException
public java.lang.String name()
public java.sql.Connection connection()
public int currentValue() throws DataSetException, java.sql.SQLException
nextValue()
public int nextValue() throws DataSetException, java.sql.SQLException
currentValue()
public static void create(java.sql.Connection conn, java.lang.String seqname, int increment, int start) throws java.sql.SQLException, DataSetException
conn
- java.sql.Connection objectseqname
- Sequence nameincrement
- Sequence incrementstart
- Start value of Sequencedrop(java.sql.Connection, java.lang.String)
public static void drop(java.sql.Connection conn, java.lang.String seqname) throws java.sql.SQLException
conn
- java.sql.Connection objectcreate(java.sql.Connection, java.lang.String, int, int)
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs60 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |