Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> sequences

sequences

From: Glenn Travis <Glenn.Travis_at_wcom.com>
Date: Wed, 12 Jul 2000 12:03:36 -0400
Message-Id: <10556.111824@fatcity.com>


This is a multi-part message in MIME format.

--Boundary_(ID_yfLHQgKciZ+K6GWet43b/Q)
Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit

I wanted to ask how people are handling the insertion of unique keys in Oracle. Please understand that my experience with generating unique keys comes from an Informix background, wherein you can have a column with datatype of 'serial'. This is an integer column which gets generated at insert time with the next value automatically. You can then check the sqlca area (return buffer) for the inserted value.

I know in Oracle you can accomplish this with the SEQUENCE function. As this is not automatically inserted by Oracle, how is the unqiue key value inserted? Do most people use a before trigger, stored procs, or call the sequence themselves? If using a client program (c, java), how is the value for the unique key returned to the program which performed the insert?

Examples, methods, design recommendations welcome...

--Boundary_(ID_yfLHQgKciZ+K6GWet43b/Q)
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 content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D770075615-12072000>I =
wanted to ask how=20
people are handling the insertion of unique keys in Oracle.&nbsp; Please =

understand that my experience with generating unique keys comes from an = Informix=20
background, wherein you can have a column with datatype of = 'serial'.&nbsp; This=20
is an integer column which gets generated at insert time with the next = value=20
automatically.&nbsp; You can then check the sqlca area (return buffer) = for the=20
inserted value.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D770075615-12072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D770075615-12072000>I know =
in Oracle you=20
can accomplish this with the SEQUENCE function.&nbsp; As this is not=20 automatically inserted by Oracle, how is the unqiue key value = inserted?&nbsp; Do=20
most people use&nbsp;a before trigger, stored procs, or call the = sequence=20
themselves?&nbsp; If using a client program (c, java), how is the value = for the=20
unique key returned to the program which performed the=20 insert?</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D770075615-12072000>Examples, methods,=20 design recommendations welcome...</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>
Received on Wed Jul 12 2000 - 11:03:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US