Home » RDBMS Server » Server Administration » Sequence in PL/SQL
Sequence in PL/SQL [message #372956] Tue, 20 March 2001 00:31 Go to next message
Arjun V
Messages: 14
Registered: March 2001
Junior Member
I hv simple sequence:-

sql>create sequence s1
start with 1
increment by 1
nocache;

when i give command in SQL*Plus i get the output
sql> select s1.nextval from dual;
1

till this it is ok

when i m using in the application like below i m getting the error

sql> DECLARE
V_NO NUMBER;
BEGIN
SELECT S10.NEXTVAL INTO V_NO FROM DUAL;
DBMS_OUTPUT.PUT_LINE(V_NO);
END;

DECLARE
*
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 4
---
please help me solve the above problem.
thanks in advance..

Arjun V.
Re: Sequence in PL/SQL [message #372965 is a reply to message #372956] Tue, 20 March 2001 03:54 Go to previous messageGo to next message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi
Try this one,

SELECT S10.NEXTVAL INTO V_NO FROM DUAL where rownum = 1;

Someone may inserted rows in DUAL table.

S.Thirumalai
Re: Sequence in PL/SQL [message #372966 is a reply to message #372956] Tue, 20 March 2001 03:54 Go to previous messageGo to next message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi
Try this one,

SELECT S10.NEXTVAL INTO V_NO FROM DUAL where rownum = 1;

Someone may inserted rows in DUAL table.

S.Thirumalai
Re: Sequence in PL/SQL [message #372967 is a reply to message #372956] Tue, 20 March 2001 03:56 Go to previous messageGo to next message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi
Try this one,

SELECT S10.NEXTVAL INTO V_NO FROM DUAL where rownum = 1;

Someone may inserted rows in DUAL table.

S.Thirumalai
Re: Sequence in PL/SQL [message #372968 is a reply to message #372956] Tue, 20 March 2001 03:58 Go to previous message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi
Try this one,

SELECT S10.NEXTVAL INTO V_NO FROM DUAL where rownum = 1;

Someone may inserted rows in DUAL table.

S.Thirumalai
Previous Topic: Update statement
Next Topic: ORA-01562
Goto Forum:
  


Current Time: Sat Jun 29 00:07:05 CDT 2024