Plsql-Order by Issue

Hi all,
I have an interesting issue with the below SELECT.
Its about using ORDER BY clause to sort.(am doing it with a variable "p_sortby".)
Order by can be used by column name or column position, (1, 2, … etc. ).
Somehow, if I use position in the PL/SQL, it doesn’t work.
So I have to use column name which we can’t simply passing a varchar2 string there,
we need to use real column name. I noticed that it only applies to varchar2 type column though.
It doesn’t apply to for instance, a number column.
Can you all please advise me on this kind of issue about how to solve.
I am editing the code section because now the question is very simplified as to what is the issue?
Let’s say p_sortby = ‘memberCount’ in this case, I passed it as first argument in decode(),
select distinct gl.group_id,
      decode('memberCount', 'name', gl.group_name_key,'description', gl.group_description_key, 'memberCount', gl.member_count) as p_sortby,                                    
                                               gl.group_name,
                                               gl.group_description,
                                               gl.status_code,
                                               gl.member_count,
                                               (select grpp.group_name
                                                  from clm_test_relationship grel join clm_test grpp
                                                       on grel.parent_group_id =
                                                            grpp.group_id
                                                 where grel.child_group_id =
                                                          gl.group_id)
                                                         as parent_group_name,
                                               gl.group_name_key,
                                               gl.group_description_key
                                          from clm_test gl
                                         where gl.group_org_id = '3909'
                                           and (   gl.group_name_key like
                                                          '%' || 'GROUP' || '%'                                               
Order by 2;                                               
It doesn’t work.
But if I pass ‘name’ as first argument in decode, it works.. That’s my original issue about why it doesn’t apply on memberCount. Edited by: user_7000011 on Apr 29, 2009 9:35 PM

Presently,I have this SELECT which returns data ordered as given below.
select distinct gl.group_id,
                                               gl.group_name,
                                               gl.group_description,
                                               gl.status_code,
                                               gl.member_count,
                                               (select grpp.group_name
                                                  from test_group_relationship grel join test_group grpp
                                                       on grel.parent_group_id =
                                                            grpp.group_id
                                                 where grel.child_group_id =
                                                          gl.group_id)
                                                         as parent_group_name,
                                               gl.group_name_key,
                                               gl.group_description_key
                                          from test_group gl
                                         where gl.group_org_id = '3909'
                                           and (   gl.group_name_key like
                                                          '%' || 'GROUP' || '%'
                               order by gl.group_name_key, convert (gl.group_name,     , 'WE8EBCDIC500')
The output is below.I have tried indenting the columns to paste the data.
GROUP_NAME                                            GROUP_NAME_KEY
Add Group Basic Flow                                 ADD GROUP BASIC FLOW
Administrative Group                                   ADMINISTRATIVE GROUP
Amy Group 33                                             AMY GROUP 33
Amy Test Group 1                                         AMY TEST GROUP 1
another add group test from matt                     ANOTHER ADD GROUP TEST FROM MATT***My Question is in the FIELD GROUP_NAME--> how can i SORT DATA using ORDER BY so that lowercase letters will be sorted before uppercase letters.*
Expected output is :-
the row with GROUP_NAME value-- "another add group test from matt" has to come at the first place.This way lowercase letters are sorted first and then UPPER CASE.
Please help me .The order by on GROUP_NAME_KEY has to be mantained and it stores data in CAPS

Similar Messages

  • Purchase order save issue, Using through BADI  PROCESS_PO_CUST ME21n

    Hi,
    Pls  Experts ,can we have some solution for this
    Purchase order save issue,  we are Using  BADI  PROCESS_PO_CUST currently we are throwing a
    message  using MMPUR_MESSAGE_FORCED if mandatory custom fields are not entered by the User,
    When we are saving the PO we are getting a exception which is raised by us ( custom message ) .
    Pls let me know is there any way to clear the message or to make mandory custom fields to be entered by user ..
    thanks  in advance...
    PK

    Hi Arnab,
    Thanks for quick response ..
    My requirement is if user is not entering the cusome fields then  i dont want to allow him to process any other Tabstrips  in the order .. thats the reason i am throwing an error message asking to enter custom fields.. then once user enters the custom fields which are created by   me .. then i should consider those values for further process like some other tab strips values maintained by the user then when we try to Save the PO still my custom error will be creating issue its not allowing to save..
    Can i have some solution ..
    thanks in advance.
    kumar

  • Purchase order status issue

    Hi Everyone
    I am having an issue with the status of Purchase order. When the Purchase order has single account assignment, everything is fine. But when I create a purchase order with multiple account assignment, the first line item is correct but when I ad second line, the still to deliver quantity gets added correctly but the amounts only reflect the recent item and not the previous one.
    For example:
    Item 10            Quantity 10           
    Item 20            Quantity 10         CC xxxx         GL account 666666
                                                       CC yyyy         GL account 666666
    Status:    Ordered        20              200
                    Still to deliver 20             100
    Please help me with this issue.
    Thanks,
    Shalu
    Edited by: Shalu G on Feb 9, 2010 12:07 AM

    Resolved myself

  • Sales order cost issue

    Hi All,
    I need help with the production issue.There are 2 sales orders which have cost recognized in one of the month
    but they are not posting to WIP.Can anyone explain me the reason for this problem.
    Thanks in advance.
    Edited by: Reema Sen on Jun 10, 2009 2:19 AM

    Hi,
    You will have to enable project manufacturing if you want to collect manufacturing cost on a project. Once you create a project, add this project to a project manufacturing organization through a PJM responsibility. Once you associate project and PJM org you will be able to put the PJM organization in the sales order line created on a Project sales order in Oracle OM. Also, mention the project number in that sales order.
    Once this sales order is shipped, run the cost collection program and it will bring in the manufacturing costs to project.
    Hope it helps
    Regards
    Kaushal

  • Sale Order Performance Issue.

    Hi,
    We are using EBS 12.0.6 and Database is 10g (10.2.3).
    We are facing performance issue with "Order management Sale Order Form",
    When user click on "Line Items" Tab of "Sale Order Form" and
    In "Main" Tab entring the "Ordered Item" then press tab and entring the "Qty" of item, its takes time 20 to 30 Second for one item if its related Items exists.
    We have 150 entiries against one sale order. Users are facing 20-30 second delay on each entry.
    Please advise how to improve the performance when related Itms exists?
    Thanks,
    Edited by: user12007410 on Feb 4, 2010 12:00 AM

    Pl create a trace file as outlined in MOS Doc 564817.1 (How To Create Forms And Database Level Trace For Receiving Transactions) to help pinpoint what SQL is causing the issue. Then open an SR as this may be a known issue for which a patch exists.
    Pl also verify that database statistics are current - see MOS Doc 169935.1 (Troubleshooting Oracle Applications Performance Issues) - section on "Statistics Gathering"
    HTH
    Srini

  • Production Order Cancelled Issue

    Hello PP Gurus,
    I have a issue related to production order
    I creae a Sales order with order qty 10
    Then I created 2 Production Order with Transaction CO08 each with 5 qty.
    Then I go through the transaction MDBT and Then ME57. ME57 shows that I need to purchase 10 qty.
    Then when I do MD04 it shows that the 2 production orders and the purchase requisition fo 10
    Then again I do MDBT
    It shows that the 2 production order were cancelled and a PR is opened in its place
    Kindly tell me the reason why the order are cancelled and the PR is still there.
    Regards
    Nilesh

    First I would like to know, whether the material is In housed production or external procurement?
    I feel as per the master data of the material, the material is externally procured. Then why you want the production order for the material.
    It shows that the 2 production order were cancelled and a PR is opened in its place
    I feel as per the  schedule line category in sale order/ material master, the material is relevant to purchase not a production, that's the reason the order is cancelled.

  • Sales Order replication issue from SAP CRM  (7.0) to ECC

    Hi,
    I have issue in replicating the sales order from CRM to ECC below are the issue details ...
    Issue:
    Sales Order is created in CRM and Mbdoc is generated with status:001 (Yellow state),Order is not replicated to ECC system.
    I am trying to Replicate the sales Order1.Created Trnascation type: ZLS1 in CRM
    2.Number range assigned as Internal in CRM and External number range in ECC
    3.Item categories has been defined in Both the system.
    4.SMOEAC settings are completed successfully.
    5.Maintained table:SMOFPARSFAin both systems.
    Checked Couple of things:
    1.No items found in SMQ1 (Out bound queue ) in CRM
    2.Checked in SMQS,none of the entries found.
    Please let me know if i missed any of the settings to replicate the sales OrderPlease help us on this regards ASAP
    Thnaks.
    CRM Consultant.

    >
    Robert Kunstelj wrote:
    > Check in status shema of that order that it doesn't block distribution to R3.
    >
    > Also check that you don't have any fillters set in R3AC1.
    >
    > And also tell me, do you see in SMW01 CSA mbdoc for that orders? If yes, are they in red state and when you select one and click on button Show bdoc message extended data, do you get structure or not?
    >
    > Regards.
    Hello Robert,
    Here is the answers for the questions raised...
    1. I checked status schema ,understand distribution status is " To be distributed " in the sales order in CRM
    2.In R3ac1 ,standard document "SALESDOCUMENT " doesn't have the any filter setttings related to my transaction type.
    3.Mbdoc (Notification ) is generated in SMW01 with status " 001 " (Yello state),failed to reprocess the Bdocs.I coudn't able to find the Outbound queue in CRM for the corresponding order in CRM.
    4.I can see the Bdoc structure in the extended data in SMW01.
    Thanks.
    Sathya.

  • PM Order Scheduling - issue

    Hi experts
    I'm having issues in the scheduling of PM work orders.
    I'm using unplanned WO. They are created from the notifications. Upon indication of operations ( with time for each operation) and components, i set the work order as planning complete (user status). At this point, the system status is created and material availability not check.
    When i hit "schedule button" on the WO, i get the message:
    Scheduling log does not contain any entries
    Message no. C7119
    My WO type is configured with the following:
    : Ajust basic dates, adjust dep. reqmts to operation date
    * Scheduking type: Forwards
    * Automatic Scheduling
    The control key has the following sets
    * Scheuling
    * Det. Cap. Req.
    * Print
    * Print time tic.
    * Confirmation required
    * Print confirmation
    My work center has the following:
    * Work Center category: 0005 (Plant Maintenance)
    * Capacity category: 002 (person)
    CAPACITIES
    Operating time: 6h
    * Relevante for finite scheduling
    * can be used for several operations
    * long term planning
    On the other hand, when i analyze CM07 and CM25 i always get the following message
    There are no capacity requirements for the current selection and
    settings
    Message no. CY144
    I have created 2 profiles to analyze WC loads/Work order leveling - 7 day and 30 day
    Even when I use tcodes like CM02, i get the message that no work orders are selected.
    So I'm either missing some config or some step.
    Can you please provide some clarity on this?
    Thanks in advance
    Joana

    Hi
    I'm still having doubts.
    So, just for my understanding, what should you get from "hitting" schedule button in the WO?
    Let me elaborate on my questions (mostly the second one)
    I create the the WO. based on the basic dates defined, and the work center capacities, and operations durations, the system will define in the operation detail the dates.
    when i n going through CM07 and CM25 i should be able to get the full picture, right? work centers capacities, what is compromised, in which WO?
    I get nothing like that. So it seems that althoug i indicate a WC in the WO (it is set for finite scheduling), there is no place where i can get the full picture.
    my assumption is that with this info in CM25 i would be able to adjust the scheduling made "automaticaly" by the system (based on my config), to better adjust the work to be done.
    Can you provide some clarity on the steps, cause i'm missing something for sure.
    Many thanks
    Joana

  • Vendor Drop Ship Sales Order statues Issues

    Process flow : OR ( item category ZVDS u2018Vendor Drop Ship" ) >> PO >> MIGO >> Invoice ( its order related billing ) no delivery involved in this because of drop ship
    after sales order OR system generate PR and PO and if customer reject the PO so user put line item as mark for deletion in PO we cant delete PO and its tie up with Sales order and Over all statues at header lever is OPEN u2026is there any way where we can change over overall statues in sales order
    We have an significant amount of these orders that continue to appear in numerous reports when they should not be of selected criteria,
    But the main issue being when these orders are cancelled, returned, etc. They are not removed from VF04 "Billing Due list".

    Pls reply me

  • ERP Sales Order : Performance issues with Product Proposal

    Hi
    we are working on CRM 2007 solution and are facing serious performance issues with the ERP Sales Order functionality provided in the ICWC of this version.
    In our development we are adding items in the ERP cart as soon as the user clicks on the 'New Sales Order' button of the sales order sreen. We get the items by very simple and optimized call to the ERP system and then add these entities in the Item Cart (Item collection ...in simple sense).
    For adding 10 items the application takes 10 seconds and this is too much for adding just 10 items.
    Can you please provide any Notes/alternative solution to resolve this issue.
    Regards
    Ajitabh

    Hi Ajithabh,
    Please apply the following SAP notes:
    1061423 - Interaction Center ERP Order Performance improvement
    1262277 - Performance: CRM value help causes dumps in ERP
    1292817 - Performance: Reduce RFC calls during creation of ERP order.
    1319885 - ERP sales order search with external reference
    1326527 - Reducing number of RFC calls in IC ERP Sales Order
    I hope it helps!
    Regards,
    Gabriel Santana

  • Sales order form issues

    Hi,
    Sales order form takes lots of time to get closed on r12.0.4 vison instance why?
    Regards

    Hi,
    Can you reproduce the issue on some other instance (same release)?
    Was this working properly before? If yes, any changes have been done recently?
    Try to generate the form via adadmin, and run the "Gather Statistics" concurrent program and see if this helps.
    Also, enable trace and generate the tkprof file, this may help in getting details about the issue -- (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12).
    The following documents may be applicable, go through it and see if it helps.
    Note: 845014.1 - Saving Of Sales Order Reservation Too Slow With Lots
    Note: 739486.1 - Performance Issue When Querying Sales Order From Sales Order Form
    Regards,
    Hussein

  • Excise duty condition type and Purchase Order Print Issue

    Dear Friends,
    We have a issue related to Purchase order print out.
    We are maintaining TAXINN.
    We have implemented CIN and we are maintaining Excise Conditions i.e. Basic Excise in JMOP
    In FV11 we are maintaining values for JMOP with plant and material Group combination.
    In Purchase Order Tax calculation is happening correctly.
    But issue is to find the value of taxes for Purchase Order Print.
    We are using function module CALCULATE_TAX_FROM_NET_AMOUNT
    and passing values of Company Code, Country, Currency, and Base amount to get the entries in condition types.
    But we are not getting any entry even after passing the values.
    How we can get these values in JMOP.
    Regards
    Kant

    Why do you want to calculate the taxes during the PO Print when you are getting correct values in PO itself?
    Modify your print program with pulling values directly from EKPO/ EKKO Tables and display it to Spool.
    check with ur ABAP Person

  • Transfer Order Status Issue

    Hi All.
    For the delivery we are Creating the Transfer Order using the Transaction LT03 . Currently we are having issue with Transfer Order status.When we look the document flow for the transfer order, TO status reads as "Completed" instead of "open" whereas deleviry status is still in "being Processed" status.
    Please give me the solition , why status goes to "Complete" status instead of "Open".
    Thank you,
    Cha
    Edited by: Chabalan on Oct 5, 2011 10:57 AM
    Edited by: Chabalan on Oct 5, 2011 11:00 AM

    Hi Cha,
    I thought it is a one-off issue.
    You mean the TO is not yet confirmed using LT12 but status already shows complete?
    Delivery is in correct status as the pick/pack and PGI steps are not completed..but for TO status, if it's confirmed then it should be complete.
    Pls confirm what's your scenario?
    Regards,
    Raghu.

  • Purchase order workflow issue

    Hi All,
    A PO is created and rejected by a user in user decision step.The workflow will end.If the PO is changed(amount) again,the release strategy is triggered for the same user.But the workflow is not triggering.If the release strategy is for a different user,its triggering the workflow.I have used a fork inside which 1 parallel branch contains a wait for significantly changed event & another branch contains the user decision step,po release step & rejection reason scenario.
    Please refer the thread below.
    PO Release Strategy Issue
    Replies will be greatly appreciated.
    Edited by: Feddie on Jan 3, 2008 11:43 AM

    Hi,
    This is not workflow issue(work flow is different term)
    It seem problem of BADI (program written for creation of purchase order based on sales order)
    Take help of ABPer so he/she can solve this issue
    Kapil

  • Purchase Order version issue...

    Hi,
    We are facing one very picular issue.
    Whenver an PO is getting created with reference to the Shopping Cart or through carry out sourcing or a direct PO, system is generating the version as 2.
    Actually, once the SC is approve through various stages or when we are creating a PO using carry out sourcing or we are creating an puchase order directly then the version should always be zero.
    Can somebody help/guide me to resolve this issue.
    Thanks in advance.
    Regards,
    ~Abey

    Whenver an PO is getting created with reference to the Shopping Cart or through carry out sourcing or a direct PO, system is generating the version as 2.
    Not only PO, but all business document types that are configured to have versioning turned on have the same behavior as you described, which is standard. The reason is that when PO is first created and ordered, a historical version is generated as a copy of the active document. That historical document is given version 1. The current active document would then be 2 to begin with. There has never been a version zero concept in SRM standard.

Maybe you are looking for

  • Photos and text disappearing

    I work for a magazine publication. Since using Indesign CC I have had the following problem happening regularly: work disappears! I can select all and see where it is meant to be, and when I click 'fit to frame' the photos come back, but the text goe

  • Cannot read from database correctly

    Hi all, I'm new to Berkeley DB. I'm trying to write a simple program to create a very simple database and then read the data from it. I built the Berkeley DB binary correctly and I don't have any syntax or linking errors. This is the code that I wrot

  • Agent Weightage in VSTS for Load test

    Hi, 1- Could you let us know the Default Weightage assigned to Agents by Controller. 2- Could you please let us know if the assumption made in the below scenario is correct- Scenario - We need to run a Load test by simulating the Total load of 100 us

  • Internal File Access

    I was wondering if it a java application being executed from a JAR is allowed to acces files within that same JAR? I mean read-and-write, besides maybe the actual CLASS files being executed.

  • Premiere Elements 10 Freezing while editing

    I apologize in advance if this has been brought up before, but I have searched for a solution with no results. Since installing Premiere Elements 10 this week, i have expirenced many freezes with the program that has forced me to exit out of the prog