oracle - ORA-01422: exact fetch returns more than requested number of rows -


stuck error...

declare  avgruntime                            number(10,0);  perfcategoryrangelocount              number(10,0);  perfcategoryrangehicount              number(10,0);  dw_low                                number(10,0);  dw_hi                                 number(10,0);       cursor lc_abc  select distinct(ap.dwprocessid)  auditprocess ap, dwprocess d ap.dwprocessid = d.dwprocessid , ap.insertts > sysdate - 61 , dwprocessmonitorind = 'y';  begin  rec in lc_abc loop  select ((ap.lastupdatets - insertts)*24*60*60) avgruntime, (.1 * ((ap.lastupdatets - insertts)))as perfcategoryrangelocount , (1.9 * ((ap.lastupdatets - insertts)))as perfcategoryrangehicount avgruntime, perfcategoryrangelocount, perfcategoryrangehicount auditprocess ap ap.dwprocessid = rec.dwprocessid  , insertts > sysdate - 61 group (ap.lastupdatets - insertts); 

[error][1] @ line 1 ora-01422: exact fetch returns more requested number of rows ora-06512: @ line 27

you grouping ap.lastupdatets - insertts , if have 2 different values error rise since cannot insert 2 rows variable. maybe should not group columns , use aggregation function on select clause like:

select avg((ap.lastupdatets - insertts)*24*60*60) avgruntime,        min(.1 * ((ap.lastupdatets - insertts)))as perfcategoryrangelocount ,        max(1.9 * ((ap.lastupdatets - insertts)))as perfcategoryrangehicount avgruntime, perfcategoryrangelocount, perfcategoryrangehicount auditprocess ap ap.dwprocessid = rec.dwprocessid  , insertts > sysdate - 61; 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -