unique id's and incr 
Author Message
 unique id's and incr

This is a multi-part message in MIME format.

------=_NextPart_000_00BC_01C113BB.F533CF70
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Gary,

The most generic way to do this is to create a sequence, and then select
next('sequencename') and use that to insert into the row

Dave

Quote:
 -----Original Message-----


Sent: July 23, 2001 8:00 PM

Subject: [GENERAL] unique id's and incr

During the creation of my database, I'm doing a:

CREATE UNIQUE INDEX account_idx ON Accounts (account_id);

to add new rows to my table and keep the id's unique.

During runtime (accessing by JDBC), is there anyway when adding a new
row to a table to know the last id entry so as to incr the next one for
a new id. I was thinking there might be a way to do this w/o having to
query the table for the last id and incr the id before I do another
insert.

Any help much appreciated.

------=_NextPart_000_00BC_01C113BB.F533CF70
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-=
1">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D398360401-24072001>Gary,</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D398360401-24072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN class=3D398360401-24=
072001>The=20
most generic way to do this is to create a sequence, and then select=20
next('sequencename') and use that to insert into the row</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D398360401-24072001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D398360401-24072001>Dave</SPAN></FONT></DIV>
<DIV><SPAN class=3D398360401-24072001></SPAN><FONT face=3DTahoma><FONT size=
=3D2><SPAN=20
class=3D398360401-24072001><FONT color=3D#0000ff=20
face=3DArial>&nbsp;</FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=3DTahoma><FONT size=3D2><SPAN=20
class=3D398360401-24072001>&nbsp;</SPAN>-----Original Message-----<BR><B>Fr=
om:</B>=20

rg]=20
<B>On Behalf Of </B>G.L. Grobe<BR><B>Sent:</B> July 23, 2001 8:00=20

=20
unique id's and incr<BR><BR></DIV></FONT></FONT>
<BLOCKQUOTE style=3D"MARGIN-RIGHT: 0px">
  <DIV><FONT face=3DArial size=3D2>During the creation of my database, I'm =
doing=20
  a:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>CREATE UNIQUE INDEX account_idx ON Accou=
nts=20
  (account_id);</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>to add new rows to my table and keep the=
 id's=20
  unique.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>During runtime (accessing by JDBC), is t=
here=20
  anyway when adding a new row to a table to know the last id entry so as t=
o=20
  incr the next one for a new id. I was thinking there might be a way to do=
 this=20
  w/o having to query the table for the last id and incr the id before I do=
=20
  another insert.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Any help much=20
appreciated.</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_00BC_01C113BB.F533CF70--



Sat, 10 Jan 2004 09:18:32 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Unique ID's

2. Unique ID's from Inside/Outside

3. Unique ID's Finding Next and Spares?

4. Help: updating multiple local database tables with unique id's in multiuser environment

5. Insert trigger creating unique id's ?

6. rollback doesn't reclaim unique id.

7. How unique are the Session ID's?

8. ORACLE globally unique id's

9. Unique System ID's across multiple tables

10. Generating unique ID's

11. Methods for creating Unique ID's

12. Unique and sensible ID's


 
Powered by phpBB® Forum Software