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: question about sequences.

Re: question about sequences.

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Sun, 16 Feb 2003 10:33:39 -0800
Message-ID: <3E4FD982.EDE9B0B0@exesolutions.com>


Jim Kennedy wrote:

> I think the question was aimed at finding out that someone had added a row
> to dual and that will cause problems with applications that use dual
> expecting 1 row.
> Jim
>
> --
> Replace part of the email address: kennedy-down_with_spammers_at_attbi.com
> with family. Remove the negative part, keep the minus sign. You can figure
> it out.
> <Kenneth Koenraadt> wrote in message
> news:3e4f8b9d.629164_at_news.inet.tele.dk...
> > On Sat, 15 Feb 2003 18:17:04 GMT, "Ryan" <rgaffuri_at_cox.net> wrote:
> >
> > >I got a trick question in an interview and I dont know if what I said was
> > >write. It was a written exam so I couldnt ask.
> > >
> > >Someone does
> > >
> > >select sequence.nextval
> > > from dual;
> > >
> > >you get two sequence numbers back. All I could think of was that someone
> > >inserted a second row into dual.
> > >
> > >Could any other reason lead to two sequence numbers being returned?
> > >
> > >
> >
> > Hi Ryan,
> >
> > Maybe the question was just awkwardly asked. I guess they wanted to
> > test if you knew about both sequence.NEXTVAL and sequence.CURRVAL :
> >
> > Nextval is returned from the statement. No doubt. And if you
> > afterwards do :
> >
> > select sequence.currval from dual;
> >
> > You get the same value again. In that sense, you can say that you get
> > 2 values at your service, *because* :
> >
> > If you start a user session and have a sequence myseq and issue :
> >
> > select myseq.currval from dual;
> >
> > You get ORA-08002: Sequence MYSEQ.CURRVAL not yet defined.....
> >
> > You have to invoke NEXTVAL by *first* calling
> >
> > select myseq.nextval from dual;
> >
> > and *then* you can do ;
> >
> > select myseq.currval from dual;
> >
> > So "select sequence.nextval from dual" does, make another value
> > avilable : sequence.currval.
> >
> > Interviewers trying to make tricky questions, are often tricking
> > themselves instead....
> >
> > - Kenneth Koenraadt
> >
> >
> >

As opposed to SELECT COUNT(*) FROM dual;?

The question is reasonable as a way of understanding someone's understanding of dual and how sequences work. Trying to psychoanalyze those that put together the questions may not lead to a lot of clarity as we'll likely never know why any question ends up on one of these things.

What I find more amazing is the questions and answers (especially on the OCP) that are clearly incorrect.

Daniel Morgan Received on Sun Feb 16 2003 - 12:33:39 CST

Original text of this message

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