If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > ORA-02287: sequence number not allowed here

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: May 2002
Posts: 2
ORA-02287: sequence number not allowed here

I have following insert statement.
And I get ORA-02287: sequence number not allowed here.
Any workarounds on this.
Thanks.

SQL> ed
Wrote file afiedt.buf

1 insert into app_exception
2 (select app_util_excp_id_seq.nextval
3 , FK_SUB_MODULE_ID
4 , FK_STATUS_NO
5 , FK_EXCP_TYPE_ID
6 , FK_SEVERITY_CODE
7 , DESCRIPTION
8 , COMMENTS
9 , CREATE_USERID
10 , CREATE_DATETIME
11 from app_exception
12* group by excp_id )
SQL> /
(select app_util_excp_id_seq.nextval
*
ERROR at line 2:
ORA-02287: sequence number not allowed here
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: May 2002
Location: Phoenix, AZ
Posts: 24
The problem is caused by your group by clause.
The solution is to use a subquery to group the data
and then use it result set like a table as follows:

5 rows created.

SQL> desc troytest
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER(5)
NAME VARCHAR2(30)

insert into troytest
select troytest_seq.nextval, t.*
from (select table_name from user_tables group by table_name) t;

5 rows created.

SQL> select * from troytest;

ID NAME
---------- ------------------------------
13 HR278
14 LOBDEMO
15 REPORTING_DB
16 TPS_835V3051_TPS_CD
17 TROYTEST


Troy
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: May 2002
Posts: 2
ORA-02287: sequence number not allowed here

This works.
Thank you very much.
Mahendra
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On