Order By Grouping_Id() error

The question is coming from that thread of russian forum.
SQL> with tab1 as
  2  (select 'CompanyA' CompanyName, 100 Sales from dual
  3  union all
  4  select 'CompanyA' CompanyName, 200 Sales from dual
  5  union all
  6  select 'CompanyB' CompanyName, 300 Sales from dual
  7  )
  8  select grouping_id(CompanyName),
  9         decode(grouping_id(CompanyName), 0, CompanyName, 'CompanyAB') CompanyName,
10         decode(grouping_id(CompanyName), 0, sum(sales),
11                sum(CASE WHEN companyname IN ('CompanyA', 'CompanyB')
12                         THEN sales
13                    END)) sales
14    from tab1
15   group by grouping sets((),(CompanyName))
16   order by 1 desc, CompanyName
17  /
GROUPING_ID(COMPANYNAME) COMPANYNAME      SALES
                       1 CompanyAB          600
                       0 CompanyA           300
                       0 CompanyB           300
SQL>
SQL> with tab1 as
  2  (select 'CompanyA' CompanyName, 100 Sales from dual
  3  union all
  4  select 'CompanyA' CompanyName, 200 Sales from dual
  5  union all
  6  select 'CompanyB' CompanyName, 300 Sales from dual
  7  )
  8  select grouping_id(CompanyName) gr_id,
  9         decode(grouping_id(CompanyName), 0, CompanyName, 'CompanyAB') CompanyName,
10         decode(grouping_id(CompanyName), 0, sum(sales),
11                sum(CASE WHEN companyname IN ('CompanyA', 'CompanyB')
12                         THEN sales
13                    END)) sales
14    from tab1
15   group by grouping sets((),(CompanyName))
16   order by gr_id desc, CompanyName
17  /
     GR_ID COMPANYNAME      SALES
         1 CompanyAB          600
         0 CompanyA           300
         0 CompanyB           300
SQL>
SQL> with tab1 as
  2  (select 'CompanyA' CompanyName, 100 Sales from dual
  3  union all
  4  select 'CompanyA' CompanyName, 200 Sales from dual
  5  union all
  6  select 'CompanyB' CompanyName, 300 Sales from dual
  7  )
  8  select grouping_id(CompanyName) gr_id,
  9         decode(grouping_id(CompanyName), 0, CompanyName, 'CompanyAB') CompanyName,
10         decode(grouping_id(CompanyName), 0, sum(sales),
11                sum(CASE WHEN companyname IN ('CompanyA', 'CompanyB')
12                         THEN sales
13                    END)) sales
14    from tab1
15   group by grouping sets((),(CompanyName))
16   order by grouping_id(CompanyName) desc, CompanyName
17  /
with tab1 as
(select 'CompanyA' CompanyName, 100 Sales from dual
union all
select 'CompanyA' CompanyName, 200 Sales from dual
union all
select 'CompanyB' CompanyName, 300 Sales from dual
select grouping_id(CompanyName) gr_id,
       decode(grouping_id(CompanyName), 0, CompanyName, 'CompanyAB') CompanyName,
       decode(grouping_id(CompanyName), 0, sum(sales),
              sum(CASE WHEN companyname IN ('CompanyA', 'CompanyB')
                       THEN sales
                  END)) sales
  from tab1
group by grouping sets((),(CompanyName))
order by grouping_id(CompanyName) desc, CompanyName
ORA-00979: not a GROUP BY expression
SQL>Have anyone met smth like this?
PS
SQL> select * from v$version where rownum=1;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
SQL

Hi,
Change the query as given below:
WITH tab1 AS
(SELECT 'CompanyA' CompanyName, 100 SALES FROM dual
UNION ALL
SELECT 'CompanyA' CompanyName, 200 SALES FROM dual
UNION ALL
SELECT 'CompanyB' CompanyName, 300 SALES FROM dual
SELECT grouping_id(CompanyName) gr_id,
DECODE(grouping_id(CompanyName), 0, CompanyName, 'CompanyAB') Company_Name,
DECODE(grouping_id(CompanyName), 0, SUM(SALES),
SUM(CASE WHEN companyname IN ('CompanyA', 'CompanyB')
THEN SALES
END)) SALES
FROM tab1
GROUP BY GROUPING SETS((),(CompanyName))
ORDER BY grouping_id(CompanyName) DESC, CompanyName
Regards
K.Rajkumar

Similar Messages

  • Unable to confirm transfer order due to error message "enter a storage unit

    Hi guys:
    I am unable to confirm transfer order due to error message popping up and saying "enter a storage unit", and I tried to search it in whole thread in the forum,it was suggestion to pick up destination storage unit via ls24, but I did went to ls24 and trying to click that line(transfer order) but unable to find the storage unit, so is there another way to fix it?

    Hi Allen...
    Pls check if your Storage Type is SU Active. If yes, then system will create a storage unit according to the setting done for the storage unit management, perhaps in your case you are confirmin TO for the putaway.
    Pls confirm and revert
    Regards
    Shiva

  • Mass sales order costing(ck55) error

    hi
    If i do individual sales order costing , no error.But same sales order has done in ck55,error"item is not relevant for billing" ,but in single sales order costing is ok, .what is reason.
    system message
      Item is not relevant for billing
        Message no. CK_MCSO029
    Note
        You can remove this message from the log with the customizing
        transaction User-Defined Error Management for Mass Costing of Sales
        Documents. The item will still not be costed, however.
    Diagnosis
    System Response                   
    reg
    nagesh
    Edited by: nageshrr on Jul 5, 2011 2:01 PM
    Edited by: nageshrr on Jul 5, 2011 2:04 PM

    no replies and my thread was dead.

  • Work order SETTLEMENT RULE Error

    Workflow Work order SETTLEMENT RULE Error, but settlement is done no problem in updation. But notification error there.
    Notification of completion cannot be generated
    Problems occurred when generating a mail
    Error '9' when calling service 'SO_OBJECT_SEND'
    Error handling for work item 000112476185
    Work item 000112476185: Object 000020154849 method UPDATESETTLEMENTRULE cannot be executed
    Call transaction was canceled.
    No errors occurred -> Details in long text
    No errors occurred -> Details in long text
    Please advice what could be the reason this error.
    Best Regards,
    Prabhakar

    Message no. WL821
    Message no. FD009
    Message no. WL863
    Problems occurred when generating a mail
    Message no. SWF_RUN534
    Error handling for work item 000133673828
    Message no. SWF_RUN630
    Error '9' when calling service 'SO_OBJECT_SEND'
    Message no. SWF_RUN535
    Thanks,
    Prabhakar

  • "Missing information in order to join" error for Shared Calendars

    I have shared Calendars before with various people and they all work flawlessly. Unforunately, one person who I am trying to share a calendar with got a "Missing information in order to join" error message when she tries to join. I have no idea why this is happening. She has a hotmail email address. Any idea/suggestions as to why this could be happening?
    I am using a 4S, she is using a 4.

    Yup, I got the same thing.  Further info:  I set up the shared list on my mac, then sent the list to my wife who tried to open it on her iPhone 5 and got redirected to the iCloud sign in page and then got the above error.  We then tried it via her hotmail account and signing into iCloud on a web browser on her computer.  Same error.
    Edit:  Further further info:  the ability to share a Reminder list is new in 10.8.2.  It can't be done via the iCloud web interface or the iPhone interface.
    Anybody know how to solve this?

  • While saving maintenance order system throughing error

    Hi,
    we have assigned wbs element in Add data tab , But while saving that order system throughin error as"Assigning PM Order to WBS Element L-DI-0001-3-1 is not Allowed"
    regards
    Ganesh

    Hi
    Can you post the exact message with number
    regards
    thyagarajan

  • Wheni am tried to settle order i got error  There are no accrued amounts; s

    Wheni am tried to settle order i got error  There are no accrued amounts; settlement is not possible.

    Hi Guru,
    Details of production order
    Target quantity =1,063,893      Delivered quantity =1,063,893     confirmed quantity = 1,074,945     EA     Basic start =07.04.2009     Basic finish   =01.11.2010     TECO PCNF DLV  PRC  GMPS MANC RESA SETC*
    When i am trying to close order system gives Error messsage
      000 Unprocessed future change recs for order SS50008TT/1A prevent del. fl
      000 Order SS50008TT/1A is partially confirmed
    Unprocessed future change recs for order SS50008TT/1A prevent del.
    flag/completion
         Message no. CO688
    Diagnosis
         There are still future change records or error records to be process
         from the confirmation for the confirmation processes in order
         SS50008TT/1A. Possible confirmation processes are:
         o   Automatic goods receipt
         o   Backflushing
         o   Calculation of actual costs
         o   Data transfer to HR
    System Response
    You are not meant to set the deletion flag/'completed' status
    with future change records that have not been processed.
    edure
    You should process the open future change records using
    o   Predefined confimration process or
    o   The CORUPROC program, by dispatching it in Customizing in
        background job (dispatch background jobs: dispatching proc
    Check if incorrect goods movements or incorrect actual cost ca
    exist for the order, and reprocess these if necessary:
    o   Reprocessing incorrect goods movements
    o   Reprocessing incorrect actual cost calculations

  • I have applied supportpackages in wrong order.I got error. What can I do?

    I have applied supportpackages in wrong order.I got error. What can I do?

    When you install the support packages, the system check the dependencies between the support packages, if does not exist problem, the process continue, if not you can not import the support package.
    Describe the problem and the error message, to help you.
    Regards

  • HT201272 My iTunes pre order want download, error 5002

    My iTunes pre order want download, error 5002

    Hey Alexis206,
    Welcome to Apple Support Communities! I found this featured discussion, looks like someone else had that same error message in iTunes and the following steps helped them:
    iTunes Store Error message 5002
    https://discussions.apple.com/thread/4852016
    This alert is often the result of an issue with verifying your billing.
    Quit iTunes.
    Open iTunes.
    Test the issue.
    If it persists, sign in to store.apple.com using your iTunes account.
    Change your country if necessary
    Click on Change account information
    Modify or remove your credit card information.
    Click Continue.
    Test the issue.
    Have a good one,
    David

  • Trying to create a Invoice based on Order need help Error -5002

    the dreaded -5002 error is haunting me too! and I could not find a matching solution for this in the forum....
    I need help quickly on this. I am trying to create invoices for some orders so the Base - Target relationship is retained. The orders I pick are all Open (DocStatus   = O and the lines are all Open LineStatus = O)
    here is my code
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 0
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00001"
    oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
    'adding Line
    oInvoice.Lines.Add
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 1
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00002"
    oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
    'adding Line
    oInvoice.Lines.Add
    lRetCode = oInvoice.Add
    If lRetCode <> 0 Then
        gObjCompany.GetLastError lErrCode, sErrMsg
        MsgBox (lErrCode & " " & sErrMsg)
    End If

    Indika,
    Only set your base types...
    (not items & description)
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 0
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00001"
    oInvoice.Lines.ItemDescription = "IBM Infoprint 1312"
    'adding Line (to fill the second item line)
    ' the 1st line item is there by default
    oInvoice.Lines.Add
    oInvoice.Lines.BaseEntry = 48
    oInvoice.Lines.BaseLine = 1
    oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
    oInvoice.Lines.ItemCode = "A00002"
    oInvoice.Lines.ItemDescription = "IBM Inforprint 1222"
    'DO NOT Add THIS line
    ' (only if you want to add a 3rd line item)
    '''oInvoice.Lines.Add -> Don't add this
    lRetCode = oInvoice.Add
    If lRetCode <> 0 Then
        gObjCompany.GetLastError lErrCode, sErrMsg
        MsgBox (lErrCode & " " & sErrMsg)
    End If
    remember to add :
    oInvoice.CardCode = "your BP"
    oInvoice.DocDueDate = Now
    oInvoiceDoc.CardCode = txtDOCBPCode.Text

  • Sales Order Costing. Error values, need BAPI or Userexit or Enhancements

    Hi Experts,
    I have a situation to solve the Errors in Sales Order Costing.
    My Error is,  its not splitting values equally,,, (BOM Item Price Values)
    for example...
    let i have a parent Item A.
    and Child Items as A1, A2, A3.
    Now the Qty of A is 100. for each item the price value is 50. so the total value is 5000/-
    Now If i need one A, then I need 8 A1's, 4 A2's, 3 A3's.and let think A1 value and A2 value and A3 value (single Unit ) are equal. and let the value be 100.
    but in BOM i can see all the values of A1, A2, A3 as same. (500, 500, 500) but it should be (800, 400, 300)
    The single Unit Price is not multiplying with Quantity, but its equally splitting.
    Please tell me Can I find and BAPI or Userexit or any enhancements or any Configurations to do.
    Thanks & Regards
    Dileep .C

    no replies and my thread was dead.

  • Purchase Order  in SRM Error in process

    Hello ,
    We are using extended classic scenario . SRM 5.0 , ECC 6.0.
    There is a PO on SRM with status 'Error in Process ' in process .But I checked the line items of the POs. PO has been successfully created and also transfered to ECC for all the line items. In ECC too the PO is visible.
    Then why the status of the PO is not 'ordered' ? How can I do to change this status to 'ordered' ?
    Please let me know how to find out the root cause of the issue as well as how to resolve the same .
    Regards,
    Saurav

    HI,
    Could you please tell me, how did you solve this issue. I'm having the same type of issue.
    Creation of shoppingcart thro'MDM catalog. It is approved. Local Purchase order is not getting
    created because of the following error and it is not replicated to the ECC 6.0.
    in Application monitor in SRM 7.0 Portal screen.
    1. Backend error: Enter G/L Account
    2. Purchase order still contain faulty items.
    3. Issue with error showing Sum of Quantities >1.728< larger than total quantity
    PO Status is'error in process'
    Regards,
    Anjan

  • Custom Purchase Order template causes Error while generating PDF

    The standard XSLFO works, my custom one errors:
    History of the world:
    1) I downloaded the XML Publisher thing for Word, installed it no problems
    2) Downloaded the XML data definition for the Standard Purchase Order from XML Publisher Administrator
    3) Created a blank word document and created the purchase order layout from scratch using the XML Publisher plug-in
    4) Previewed it as a PDF in word - it looked fine (well, it was a start)
    5) Exported the XSLFO
    6) In XML Publisher created a new template and uploaded the XSLFO
    7) Assigned the new template to the document in Purchasing
    All good... the new template is defintately the one being used by the PO Output for Communication program. The problem of course is that it throws a useless error message :) - namely:
    PoPrintingUtil.getBlobPDF(input,input) - After initializing the FOProcessor
    PoPrintingUtil.getBlobPDF(input,input) - After setting the i/o stream and output format
    PoPrintingUtil.getBlobPDF(input,input) - Error while generating the PDForacle.apps.xdo.XDOException
    genDoc() : Exceptionjava.lang.Exception: Error while generating PDF :null
    java.lang.Exception: Error while generating PDF :null
    java.lang.Exception: Error while generating PDF :null
         at oracle.apps.po.communicate.PoGenerateDocument.genDoc(PoGenerateDocument.java:2011)
         at oracle.apps.po.communicate.PoGenerateDocumentCP.runProgram(PoGenerateDocumentCP.java:421)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:148)
    When I run POXPOPDF in Debug I get:
    getArchiveOn(): APPROVE
    After calling genDocThu May 18 12:50:05 EST 2006
    Adding the blob to vector
    java.lang.NullPointerException
    java.lang.NullPointerException
         at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
         at oracle.apps.po.communicate.PoGenerateDocumentCP.runProgram(PoGenerateDocumentCP.java:304)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:148)
    I know no one can magically fix this for me (I wish!) but does anyone have any suggestions on what to do next? I have no conditional formatting or any other more complex functionality, just a really boring PO layout with a logo.
    Any suggestions welcome, in the meantime I will keep trawling through Metalink in search of a clue ;)
    Thanks
    Jo

    Hi Jo,
    The first version for which the Template Builder was released is 5.0
    Well, I guess I am one of the few who has a backported 4.5 version of the template builder. I did that for testing exactly your case. I just replaced our xdocore.jar file with the 4.5 version and it worked. The core.jar is not easily available. The files are part of the 4.5 patch, but I think it is too much work to get them out.
    However, I would strongly recommend to upgrade to a later version of XML Publisher. We made huge improvements, since 4.5 - performance, translation, RTF template capabilities....
    I just checked the process of converting an RTF template to FO and uploading it to EBS with 5.6.2 and it still worked. So it seems you can go straight to the latest version.
    Hope that helps,
    Klaus

  • BOM not exploding in Sales order & Net Value error

    Hello Dear all,
    I have created a product "A" with BOM items 10, 20 & 30.
    Item cat. Gr for "A" is ERLA & for 10, 20 & 30 is LUMF.
    I have also created BOM with these 3 matls. (ie 10, 20 & 30).
    When processing Sales Order Item cat. appeared in SO for "A" is TAP & for other 3 is TAN. "A" shows the price maintained for it, but not showing Net Value at Header level data in SO.
    Also document is incomplete because of Net value for Items 10, 20 & 30.
    I don?t want price of 10, 20 & 30 should display in SO at Item level
    Can anyone suggest the required setting?
    Thanks
    Shan

    hi,
    For BOM mainly two material groups are used.
    LUMF and ERLA.
    If you used ERLA in the main material which consists of different materials then the pricing would be carried out only for the main item, while the other sub items pricing would not be displayed.
    while if you use LUMF then the main material would not be priced but only the sub items would be relevant for pricing the the total of all the sub items forms the basis of the sales order net value.
    regarding the net value error you can just check the pricing configuration for the steps and sub total.
    regards,
    Siddharth.
    Edited by: SD on Mar 11, 2008 7:51 AM

  • Purchase order Release Stratergy-Error in Class CL01

    Purchase Order Release Stratergy:
    In CL01(create class) i have created the class FRG_EKKO and saved.Then in CL02(change class) under Basic data-Administrative data we found Assignment field tick is not selected and that is not in changeable mode.
    Because of that reason Error occured like Error in Class in SPRO release stratergy. Release is taking place in Development Server but not in Production server.
    Regards,
    Wilson Babu G

    Hi
    This indicator shows that objects are assigned to this class.
    The indicator is set automatically by the system.
    once you assign the class to any objects then this flag will come automatically.
    Please check if you have assigned the characteristics to the Class in CL02
    Please check if you have assigned the release strategy to the Class in CL24N
    Thanks & Regards
    Kishore

Maybe you are looking for

  • OUT parameter functionality

    I thought that you are not supposed to be able to assign the value of an out parameter to a variable (Feuerstein, 5th ed) and yet I was just able to do this without any compilation error messages. Is Feuerstein wrong or am I missing something? Has th

  • Rolling of access.log and weblogic.log

    I could successfully set parameters for rolling of the above log files. But I could see that the resultant file is being named as access.log0001, access.log0002. Similarly, weblogic.log0001 etc...But I want to name the backup files as access.logMMDDY

  • Solution for "AIGLX error"

    This is not a request for help, but just a quick note that might help somebody else. I got this error in my /var/log/Xorg.0.log: (EE) AIGLX error: dlsym for __driCreateNewScreen_20050727 failed (/usr/lib/xorg/modules/dri/fglrx_dri.so: undefined symbo

  • Can't lock onto a 48k SPDIF (Toslink) digital input

    I'm using a 'StarTech AA2SPDIF' A-to-D converter which has a fixed 48k sample rate.  If I set the Mac's Digital Input to 48k it will work for a few seconds, then fall back to 44.1k.  When this happens, the audio slows down and sounds much like a 45rp

  • How to compile packages

    hi, i have a package structure root xml xmltest.java xmlans.java tts ttstxt.java ttsans.java ui uitxt.java uians.java sampletest.java how to compile all the above packages with a single javac. javac -d ????