Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007

    Question Unanswered: ORA-00934: group function is not allowed here

    Im trying to insert data into a table. One of the fields (pac_n) is a number and i want to insert a line after the Max Value. However i am getting the error:

    ORA-00934: group function is not allowed here

    The error is at the MAX(pac_n) +1 section

    My isert is below. Any Ideas?

    insert into usr_clear_setup & #40;pac_n,pac_acc,pac_mar_ref,pac_ctr_ref,pac_call,pac_broker,pac_msg,pac_acc_de
    sername) values(MAX(pac_n) +1,'ABC','DTB','*','*',' ',' ','DDRAX','A','A','FMLLO','0S821','','','','','DDRAX','DDRAX','','');

  2. #2
    Join Date
    Jul 2007
    Solved the problem. Changed (MAX(pac_n) +1 to ((select MAX(pac_n) from usr_clear_setup) +1

  3. #3
    Join Date
    Apr 2002
    Toronto, Canada
    you are selecting the max of a column value so that you can add 1 and insert into the same table

    this can lead to race conditions if you aren't careful to isolate this query from all other concurrent queries

    can you explain why you are not using a sequence for this purpose? | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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