Home » SQL & PL/SQL » SQL & PL/SQL » sequence
sequence [message #19387] Wed, 13 March 2002 23:03 Go to next message
THA
Messages: 26
Registered: February 2002
Junior Member
hello
Will any one help me? the following query works with an effect as given by rownum.
SELECT seq.NEXTVAL,empno,ename,deptno
FROM emp;

but
SELECT seq.NEXTVAL,empno,ename,deptno
FROM emp
ORDER BY deptno;
gives " sequence number not alowed here". What is the reason?
Thanks
Re: sequence [message #19394 is a reply to message #19387] Thu, 14 March 2002 04:30 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
You cannot use CURRVAL and NEXTVAL:

****A subquery in a DELETE, SELECT, or UPDATE statement
****A query of a view or of a materialized view
****A SELECT statement with the DISTINCT operator
****A SELECT statement with a GROUP BY clause or ORDER BY clause
****A SELECT statement that is combined with another SELECT statement with the UNION, INTERSECT, or MINUS set operator
Previous Topic: PL/SQL ERROR, TRIGGER PROBLEM
Next Topic: ORA-0600 [17090]
Goto Forum:
  


Current Time: Thu Apr 25 04:22:17 CDT 2024