Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: "Group By" with "Order By Decode" in PLSQL causes "ORA-00979: not a GROUP BY expression"
On 2005-02-09, omsai <pavan.sura_at_gmail.com> wrote:
> OPEN v_cursor FOR
> SELECT trs.ID TID, trs.Name SellerName,
> own.Name OwnerName,lkup.Name Status,
> COUNT (1) TransactionParcelCount,
> Sum(aqi.CURRENTOFFERAMOUNT) TotalOfferAmount,
> trs.LastUpdate LastUpdated
> FROM ACQUISITION aqi, TRANSACTIONS trs,
> Owner own , LOOKUP lkup
> WHERE lower(own.Name) LIKE''||lower(Searchstring)||'%'
> AND lkup.Category='TransactionStatus'
> AND lkup.ValueID = trs.StatusID
> AND trs.ID = aqi.TransactionID
> AND own.ID = trs.SellerID
> GROUP BY trs.ID,trs.Name,own.Name,lkup.Name,
> trs.LastUpdate
> ORDER BY decode
> (sort,'OwnerName',OwnerName,'TID',TID,
> 'TransactionParcelCount',TransactionParcelCount,
> 'TotalOfferAmount',TotalOfferAmount,'LastUpdated',
> LastUpdated,'STATUS',STATUS);
> o_cursor := v_cursor;
> ***************************************************************
I believe that your decode expression needs to be present in the select clause (and group by) for this to work.
Ingo Received on Fri Feb 11 2005 - 10:05:47 CST