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

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

RE: sequences

From: Zhong Hong <zhong_at_cantametrix.com>
Date: Wed, 12 Jul 2000 09:54:43 -0700
Message-Id: <10556.111826@fatcity.com>


This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFEC21.E08E7130
Content-Type: text/plain;

        charset="iso-8859-1"

I use sequence as much as possible. Triggers slow down the write.  

Zhong
It's another beautiful day!

-----Original Message-----
From: Glenn Travis [mailto:Glenn.Travis_at_wcom.com] Sent: Wednesday, July 12, 2000 10:23 AM
To: Multiple recipients of list ORACLE-L Subject: sequences

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...  

------_=_NextPart_001_01BFEC21.E08E7130
Content-Type: text/html;

        charset="iso-8859-1"

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

<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=281014016-12072000>I use
sequence as much as possible. Triggers slow down the write.</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<P><I><FONT face=Script>Zhong</FONT></I> <BR><FONT face="Comic Sans MS"
size=2>It's another beautiful day!</FONT> </P>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">

  <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma   size=2>-----Original Message-----<BR><B>From:</B> Glenn Travis   [mailto:Glenn.Travis_at_wcom.com]<BR><B>Sent:</B> Wednesday, July 12, 2000 10:23   AM<BR><B>To:</B> Multiple recipients of list ORACLE-L<BR><B>Subject:</B>   sequences<BR><BR></DIV></FONT>
  <DIV><FONT face=Arial size=2><SPAN class=770075615-12072000>I wanted to ask   how people are handling the insertion of unique keys in Oracle.&nbsp; Please   understand that my experience with generating unique keys comes from an   Informix background, wherein you can have a column with datatype of   'serial'.&nbsp; This is an integer column which gets generated at insert time   with the next value automatically.&nbsp; You can then check the sqlca area   (return buffer) for the inserted value.</SPAN></FONT></DIV>   <DIV><FONT face=Arial size=2><SPAN
  class=770075615-12072000></SPAN></FONT>&nbsp;</DIV>   <DIV><FONT face=Arial size=2><SPAN class=770075615-12072000>I know in Oracle   you can accomplish this with the SEQUENCE function.&nbsp; As this is not   automatically inserted by Oracle, how is the unqiue key value inserted?&nbsp;   Do most people use&nbsp;a before trigger, stored procs, or call the sequence   themselves?&nbsp; If using a client program (c, java), how is the value for   the unique key returned to the program which performed the   insert?</SPAN></FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2><SPAN class=770075615-12072000>Examples, methods,   design recommendations welcome...</SPAN></FONT></DIV>   <DIV>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML> Received on Wed Jul 12 2000 - 11:54:43 CDT

Original text of this message

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