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

Home -> Community -> Usenet -> c.d.o.server -> Re: sequence currval

Re: sequence currval

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 13 Sep 1999 09:21:01 -0400
Message-ID: <2vncN4PKEoi42og1cEpF0LCEUX8j@4ax.com>


A copy of this was sent to Mattias Malmgren <a2matmal_at_ulmo.stud.slu.se> (if that email address didn't require changing) On Mon, 13 Sep 1999 12:06:31 +0200, you wrote:

>> Thanks to all that have helped me!
>
>Well my problem with "select flfraga_seq.currval into k from dual" is that
>I get the error:
>ORA-08002: sequence FLFRAGA_SEQ.CURRVAL is not yet defined in this session
>ORA-06512: at "FLUSER.SEQ_TEST", line 6
>ORA-06512: at line 5
>
>But that turned out to be becouse my testexample was not written in a
>propper way.
>
>Still the table "dual" is a mysery for me? Where did that table come from?
>As far as I can remember I never created it. How does it come that dual
>knows the value of FLFRAGA_SEQ.CURRVAL ?
>I guess that I can look it up myself, but if you can easely explain it to
>me
>I woud be greatful.

dual is just a table that is created as part of the database -- much like SYS.OBJ$ is created for you. its part of the data dictionary tables.

DUAL doesn't *know* the flgraga_seq.currval -- the sequence flfraga_seq KNOWS its value. Pretend the sequence is a package with 2 functions -- currval and nextval. You are selecting these functions from SQL. You can pick your own table to select it from or use the one row table we have in the database.

>
> / Mattias

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Sep 13 1999 - 08:21:01 CDT

Original text of this message

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