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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem with PL/SQL / nextval

Re: Problem with PL/SQL / nextval

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 19 Aug 1999 13:35:39 +0100
Message-ID: <935066487.4712.0.nnrp-12.9e984b29@news.demon.co.uk>

It is nothing to do with PL/SQL per se.

>> SQL> run
>> 1 DECLARE
>> 2 icounter number(11);
>> 3 BEGIN
>> 4 Select SEQ_LEITUNG.NEXTVAL INTO iCounter FROM Dual;
>> 5* END;
should not return error 1422 if DUAL has only one row in it.

(That doesn't mean I disagree with your PL/SQL directives by the way - they are very sound guidelines)

The object 'dual' has to contain more than one row. However, given that you state:

>> SQL> select seq_leitung.nextval from dual;

returns only one value, then the only conclusion is that there are at least two objects named dual, and you are seeing a different one in the PL/SQL from the one that you are seeing under SQL*Plus.

Try

    select owner,object_type from dba_objects     where object_name = 'DUAL';

--

Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk

Ron Reidy wrote in message <37BBF555.3DBF1A41_at_uswest.net>...
>
>This is a PL/SQL issue. PL/SQL always executes a SELECT ... INTO twice
>in order to throw this exception. To repevent this, create an explicit
>cursor for the query, open it, fetech from it, and close it.
>
Received on Thu Aug 19 1999 - 07:35:39 CDT

Original text of this message

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