 |
|
ORA-00934: group function is not allowed here
Oracle Tips by Laurent Schneider
|
Laurent
Schneider is considered one of the top Oracle SQL experts and he
is the author of the book "Advanced
Oracle SQL Programming" by Rampant TechPress.
Question: I'm 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
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
scr,pac_acc_type,pac_open,pac_out_broker,pac_out_msg,pac_exec_fee,pac_job_in,pac
_clear_broker,pac_clear_fee,pac_back_transco,pac_transco_market,pac_devise,pac_u
sername) values(MAX(pac_n) +1,'ABC','DTB','*','*',' ',' ','DDRAX','A','A','FMLLO','0S821','','','','','DDRAX','DDRAX','','');
Answer: I would try to use sequence to avoid
the ORA-00934 error.
insert into
usr_clear_setup(pac_n,pac_acc)
values ((select max(pac_n)+1 from usr_clear_setup),'ABC');