Results 1 to 3 of 3
  1. #1
    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

  2. #2
    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

  3. #3
    Join Date
    May 2002
    Posts
    2

    ORA-02287: sequence number not allowed here

    This works.
    Thank you very much.
    Mahendra

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •