Database Settings for order By Clause

Hi,
In oracle if we do a "order by" in SQL statement for field values whose values are empty, then they would be listed at the last if we dont specify any NVL() for it.
Is there any other option by which the funcionality of Order by clause with Empty field values can be changed.
Is there any settings that can be made in the existing database , so that the Order by clause does not list the empty field values at the bottom.
Thanx in advance.
Bharath

you can do wonders with decode and nvl
for instance:
order by decode(nullable_field, null, 1, 2)would make all your null fields come first, whereas
order by nvl(nullable_field, 'M')would make them appear in the middle of an alphabetical list.
Basically NULLs are not something. You have to give the ORDER BY something to replace the null.
null

Similar Messages

  • Sorting technique used by oracle for "order by" clause.

    Hi All,
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    Issue i am facing :
    Table : xx
    Line Date
    1 05-06-2013 00:00:00
    2 05-06-2013 00:00:00
    when we query above table using order by date, it is returning line 2 prior to line 1. we would like to know why it is returning line 2 first?
    Regards,
    Ram

    >
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    >
    Well ok - but be warned that many people wind up being sorry they ask that question. Hopefully Hemant's answer is what you really wanted.
    See 'Linguistic Sorting and String Searching' in the Oracle® Database Globalization Support Guide
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch5lingsort.htm
    Sorting will be controlled by the settings of NLS_LANGUAGE, NLS_SORT and NLS_COMP.
    Here is the doc page for NLS_SORT
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008393
    >
    NLS_SORT specifies the type of sort for character data. It overrides the default value that is derived from NLS_LANGUAGE.
    NLS_SORT contains either of the following values:
    NLS_SORT = BINARY | sort_name
    BINARY specifies a binary sort. sort_name specifies a linguistic sort sequence.
    >
    And the one for NLS_COMP
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008458
    >
    The value of NLS_COMP affects the comparison behavior of SQL operations.
    You can use NLS_COMP to avoid the cumbersome process of using the NLSSORT function in SQL statements when you want to perform a linguistic comparison instead of a binary comparison. When NLS_COMP is set to LINGUISTIC, SQL operations perform a linguistic comparison based on the value of NLS_SORT. A setting of ANSI is for backward compatibility; in general, you should set NLS_COMP to LINGUISTIC when you want to perform a linguistic comparison.

  • Using bind varaible for order by clause

    Hello
    Can some one suggest for the following scenario?
    My order by clause will be constructed based on the selected fields in the form. And now the order by clause need to be passed as parameter to Excel report.
    When I use Ref cursor and OPEN-FOR-USING clause, data is not sorted.
    do we have any other alternate for this?
    Please observe the example code for the same. Block below resembles the code for to select the data for excel report.
    SQL> select * from t;
    T
    sdf
    der
    gdr
    ghft
    ytut
    lkrt
    rtrt
    tyrt
    SQL> declare
    2 l_order_by VARCHAR2 (100);
    3 l_test varchar2(10);
    4 TYPE TEST IS REF CURSOR;
    5 c_TEST test;
    6 L_string VARCHAR2(2000):= 'select * from t order by :pi_order';
    7 begin
    8 l_order_by := ' t DEsc';
    9 open c_test for l_string using l_order_By;
    10 loop
    11 fetch c_test into l_test;
    12 exit when c_TEST%notfound;
    13 dbms_output.put_line (l_test);
    14 end loop;
    15 close c_test;
    16 end;
    17 /
    sdf
    der
    gdr
    ghft
    ytut
    lkrt
    rtrt
    tyrt
    PL/SQL procedure successfully completed.
    Cheers
    Ram Kanala

    My order by clause will be constructed based on the selected fields in the formDoes this look like you need ?
    SQL> var so number
    SQL> exec :so := 1;
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on
    SQL> declare
      2   rc sys_refcursor;
      3   type emprec is table of emp%rowtype index by pls_integer;
      4   erec emprec;
      5  begin
      6 
      7   open rc for 'select * from emp order by ' ||
      8   'decode(:p,1,ename,2,deptno,3,sal,null),' ||
      9   'decode(:p,4,ename,5,deptno,6,sal,null) desc' using :so,:so;
    10   fetch rc bulk collect into erec;
    11   close rc;
    12 
    13   for i in 1..erec.count loop
    14    dbms_output.put_line('Ename = ' || erec(i).ename || ', deptno = ' || erec(i).deptno || ', sal
    = ' || erec(i).sal);
    15   end loop;
    16  end;
    17  /
    Ename = ADAMS, deptno = 20, sal = 1100
    Ename = ALLEN, deptno = 30, sal = 1600
    Ename = BLAKE, deptno = 30, sal = 2850
    Ename = CLARK, deptno = 10, sal = 2450
    Ename = FORD, deptno = 20, sal = 3000
    Ename = JAMES, deptno = 30, sal = 950
    Ename = JONES, deptno = 20, sal = 2975
    Ename = KING, deptno = 10, sal = 5000
    Ename = MARTIN, deptno = 30, sal = 1250
    Ename = MILLER, deptno = 10, sal = 1300
    Ename = SCOTT, deptno = 20, sal = 3000
    Ename = SMITH, deptno = 20, sal = 800
    Ename = TURNER, deptno = 30, sal = 1500
    Ename = WARD, deptno = 30, sal = 1250
    PL/SQL procedure successfully completed.
    SQL> exec :so := 2
    PL/SQL procedure successfully completed.
    SQL> /
    Ename = CLARK, deptno = 10, sal = 2450
    Ename = KING, deptno = 10, sal = 5000
    Ename = MILLER, deptno = 10, sal = 1300
    Ename = JONES, deptno = 20, sal = 2975
    Ename = FORD, deptno = 20, sal = 3000
    Ename = ADAMS, deptno = 20, sal = 1100
    Ename = SMITH, deptno = 20, sal = 800
    Ename = SCOTT, deptno = 20, sal = 3000
    Ename = WARD, deptno = 30, sal = 1250
    Ename = TURNER, deptno = 30, sal = 1500
    Ename = ALLEN, deptno = 30, sal = 1600
    Ename = JAMES, deptno = 30, sal = 950
    Ename = BLAKE, deptno = 30, sal = 2850
    Ename = MARTIN, deptno = 30, sal = 1250
    PL/SQL procedure successfully completed.
    SQL> exec :so := 5;
    PL/SQL procedure successfully completed.
    SQL> /
    Ename = BLAKE, deptno = 30, sal = 2850
    Ename = TURNER, deptno = 30, sal = 1500
    Ename = ALLEN, deptno = 30, sal = 1600
    Ename = MARTIN, deptno = 30, sal = 1250
    Ename = WARD, deptno = 30, sal = 1250
    Ename = JAMES, deptno = 30, sal = 950
    Ename = SCOTT, deptno = 20, sal = 3000
    Ename = JONES, deptno = 20, sal = 2975
    Ename = SMITH, deptno = 20, sal = 800
    Ename = ADAMS, deptno = 20, sal = 1100
    Ename = FORD, deptno = 20, sal = 3000
    Ename = KING, deptno = 10, sal = 5000
    Ename = MILLER, deptno = 10, sal = 1300
    Ename = CLARK, deptno = 10, sal = 2450
    PL/SQL procedure successfully completed.Rgds.

  • CIN SETTINGS FOR ORDER RELEATED INVOICE

    Please let me know what settings should be made to create excise inovoice of order releated invoice?

    There are no setting for CIN for Order Related Billing. CIN is only applicable for Delivery related Billing, as excise Duty is chargable when goods move out of plant.
    In the case that Excise Duty is to be captures in Order Related Billing, it is only possible through Excise JV through T.Code: J1IH:
    Customer Credit
    Choose the u2018Additional Exciseu2019 input the original excise invoice reference, document year, company code, plant and excise group and execute. There input manually what value you need to give credit and save.
    Cenvat Debit
    Choose u2018Other Adjustmentsu2019 and here also, maintain the datas whatever you input as above and save.
    Regards,
    Rajesh Banka

  • Passing parameter in report for order by clause

    how can we pass the name of the column on which we want the order by clause to sort as a parameter through parameter from in a report??

    Hi Guptha,
    We can create a bind parameter in report and we can send it as a parameter or enter in the parameter form.
    The Query will be
    select * from emp
    order by :Order_Bu_Column
    I think it will help you.
    Regards,
    Siva.

  • Settings for order bom

    Dear All,
    Can anyone tell me setting for order bom so that the order BOM is exploded in sales order and MRP can be carried out on this BOM
    Regards
    Prashant

    Hi,
    Pls. find the details of Maintaining an Order BOM without Variant Configuration as below :
    Create an Order BOM :
    Prerequisites:
    You have entered the sales order for which you want to create the order BOM.
    Procedure:
    1.Choose Logistics ® Production ® Master data ® Bills of material ® Bill of material ® Order BOM ® Create.
    The Create Order BOM: initial screen appears.
    2.Enter the sales order number, the order item, the material number and the BOM usage.
    If you want to use a material BOM, or an existing order BOM to copy from, go to step 4. If you want to create an order BOM without a reference, click  and go to step 7.
    You cannot use a configurable BOM as a reference.
    3.Click  Order BOM (copy order BOM) or  Material BOM (copy material BOM).
    The Copy material BOM or Copy order BOM dialog box appears.
    4.Enter the data required and click .
    The item overview appears, for the bill of material you are using as a reference.
    5.Select the items you want to copy to the order BOM and click .
    The item overview for your new order BOM appears. The items you transferred are displayed in the item overview.
    6.Enter new items and alter items if necessary. Entering items in order BOMs is similar to entering items in material BOMs. However, you cannot enter class items in order BOMs. You can find further information in the Bills of Material documentation in  Creating New Items.
    Save your order BOM.
    Example: Creating Order BOM Without Variant Configuration :
    The material BOM for material A contains components B and C, which are themselves assemblies. The material BOM for material C contains components D and E and the material BOM for material C contains components F and G.
    A sales order is created for customer Smith, with the number 821. Material A is inserted under sales order item 10 in this sales order. At the request of customer Smith, for this sales order, the bill of material for assembly C is changed manually. Component H is added to components F and G. This change should not take effect in the material BOM, because assembly C is only expected to be produced once in this form, for customer Smith.
    An order BOM is generated from the material BOM for material C. Since nothing was changed in the bills of material for materials A and B, in this sales order the material BOM will continue to be used for these assemblies.
    Hope this helps.
    Revert if any doubt and reward if useful.
    Regards,
    Tejas

  • Maps Remote Database settings for E71

    I live in South Africa, and require the Maps Remote Database settings to sync my favourites with phone and vice versa.... Can anyone help please?

    Remote Databas settings is used to integrate ACS with an oracle or sql database to generate reports in your environment.
    If you are worried about the logs being generated it would be best to setup the removal and backup configuration and point your acs to either a ftp or nfs repostoring.
    Thanks,
    Tarik Admani

  • Help for order by clause

    Hi ,
    i have a below table with data , when i run my select with order by option its gives me
    1     Card
    as a first row but i need this
    12     atm
    as a first row ,how this is possible .
    create table test
    (ID number ,
    val varchar2(20)
    insert into test values (1,'Card')
    insert into test values (2,'Card')
    insert into test values (3,'Card')
    insert into test values (4,'Cash')
    insert into test values (5,'Cash')
    insert into test values (6,'Cash')
    insert into test values (7,'Checque')
    insert into test values (8,'Checque')
    insert into test values (9,'Checque')
    insert into test values (10,'atm')
    insert into test values (11,'atm')
    insert into test values (12,'atm')
    select * from test
    order by val asc

    YOu can also use Nlssort like
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> select *
      2  from test
      3  order by nlssort(val, 'NLS_SORT = WEST_EUROPEAN_AI') asc, id desc
      4  /
            ID VAL
            12 atm
            11 atm
            10 atm
             3 Card
             2 Card
             1 Card
             6 Cash
             5 Cash
             4 Cash
             9 Checque
             8 Checque
            ID VAL
             7 Checque
    12 rows selected.

  • Settings for order type in planned orders

    Dear All,
    Where can i customise the order types for planned order.?
    My scenario is.. i can not send complete product in vehicle , which has to be dismantle and send in different vehicle, so the different invoices are required. i can dismantle  the product and add these assemblies as line item and invoice. in this case i will loose the main product code which i dont want. i wanted this to behave similar to phantom item , where i can see the phantom item and plan only components.
    Please throw sme lite on this...
    Thanks
    Raghu

    Hi
    You can customize the planned order profiles in
    SPRO--- Production MRP- Procurement proposals -
    Planned orders--- Define order profile.
    Thanks
    S.Murali

  • Planed Cost value for order

    Hi gurus,
    I'm just a beginner at this SAP module, so I would be very grateful for your help...
    When I first create a maintenance order through transaction IW31, and go to Costs tab, i wonder how Co/area Curr value is calculated, because it doesnt' seem to take it from Tcurr table since the currency change is different from the one is used in this tab.... i hope u can help me with this doubt....
    Thanks a Lot,
    Daniel Siñani

    Hi,
    Please check the your setting in customising for below path
    Plant Maintenance and Customer Service>>Maintenance and Service Processing>Functions and Settings for Order Types-->Costing Data for Maintenance- and Service Orders
    1)Maintain Costing Sheet
    2)Maintain Costing Variants
    3)Define Valuation Variants
    4)Assign Costing Parameters and Results Analysis Keys
    Regards,
    Rakesh
    Edited by: RAKESH ASHOK MANE on May 12, 2009 7:06 AM

  • Order By Clause For Retrieving Child Elements

    Hi All,
    I got a toplink question regarding adding an order by clause for retrieving the child elements in a 1 to many mapping.
    I have an Order with a collection of Order Events. ( one to many mapping). The OrderEvent model is the super class of all events and it is abstract. The mapping for the order event descriptors has a class hierarchy mapping which uses a table for its super class (i.e OrderEvent abstract class) and different tables for its sub class elements (e.g ShippingEvent, LifeCycleEvent etc which are concrete classes).
    If I add an order by clause to order the event by a spuerClassProperty in the super class descriptor, it gets ignored and the ordering is done by the alphabetic order of the indicator field values.
    I also noticed that if there is more than one sub class instance for a specific class indicator value, the ordering by is observed.
    I got around it with a Comparator, but just want to know if it could be possible to achieve this with toplink.
    Regards.

    Does the Order By appear on the SQL that get issued? TopLink only does ordering on the database, and not in memory. This means that subclass queries will be ordered per type, on not as one big list.
    A Comparator is a good solution.

  • What are the settings for  rework order  quality inspection

    HI,
    Iam doing production order confirmation at the GR time some oprations are rejected.that operations i want too rework order CO07 process without GR ,i want to Quality inspection in REWork order.
    What are the settings for rework order Quality inspection?

    Refer beautiful document
    http://wiki.sdn.sap.com/wiki/display/HOME/ReworkInProduction

  • Saving session state in database table rather in websever for Ordering App

    Hi all,
    Ours is a ordering application (telecomm) domain.
    Currently, we are storing user sessions data (Order shopping cart session data) in middle tier (iPlanet web server) which inturn consumes lot of memory resources.
    Shopping cart could be in MBs if order is a huge business order.
    So in order to not to overtax web server (middle tier), we are thinking of storing session data directly in a database table to relieve the overhead on web server and make use of database for storage.
    I read that APEX (html db) is already using this "single metadata table" approach for session data management. But we are not using HTML DB to really look into.
    Can some one advise how to go about storing "user session data" directly in a "database table" for both storage and retrieval purposes instead of storing it in "webserver".
    How does this "metadata table" structure looks like. Is it more generic ?
    Really appreciate your time and help/suggestions.

    Joel,
    Thanks for your response. sorry, i meant to say that "the current application does not use APEX but will look into it".
    To build this is an utterly non-trivial exercise. Oh - it may not be so hard to save session state to a table when you POST a page. But you may want to reference this in many places, and it's a question of can you change all of these references to indirect references from session state in your application.In order to free up the load on webserver, we want to maintain session management in database. Could you please explain the above little more :
    How do we maintain the "user session" with "database table" ?
    Do we need to store "session data" at java object level or by page in database table ? How does the structure of this "metadata table" looks like.
    Thanks for your time.

  • Settings for costing data in order types for plant maintenance

    i want to know the purpose of settings for costing data in order types for plant maintenance. do we need to do it for sure i mean are those settings mandatory to analyze the costs on work order

    Yes you need to maintain those settings, as the plant maintenance orders are also considered as cost objects and in order for you to post any cost, you need to have a cost object.  Unless you maintain these settings, the cost you posted cannot be settled to a cost center.
    Assign points as a way to say thanks.
    Madhav Nanduri

  • Customisation settings for VC Configuration copy from Purchase order to GRN(Goods Receipt note)

    Hi Experts
    I was looking for Customisation settings for VC Configuration copy from Purchase order to GRN(Goods Receipt note),
    Please share.
    Regards
    Sandeep

    Hi Ritesh
    Thanks for your reply,
    I checked  both of these transaction  we need to select 3 option Characetrstics frm configuration(prio) and classification. I will check that, I had one more question
    In PO VC configuration is called for class type-300  and  in GRN VC configuration  is called for class type -023. How it will fetch the variant class configuration to Batch class configuration?
    Once we had faced some issues the copy from PO to GRN was happening for some batches & some batches it was not happening.
    yes we have activated Mill Functions in our ERP box.
    Regards
    Sandeep

Maybe you are looking for

  • Transport of Datatargets

    Hi Experts, I activated some of infoObjects in Developement System as a $TMP.Now I am Transporting DSO and InfoCube.I copied InfoCube and DSO from Standard content InfoCube and DSO.I didn't give the request/package while activating .Now I need to pro

  • Error Durin Vendor Invoice

    Dear All, We are currently migrating from Sap R/3 4.7 to Ecc 6.0. In the Ecc 6.0 system while we are making Invoice from the TCODE F-43 - FB60 we are getting an Error. PAN not available     Message no. J1IN013 Diagnosis     You want to post a documen

  • Send break not working in M9000 XSCF.

    Dear All. I'm giving "sendbreak -d 01" form xscf, its not bring my OS to "OK" prompt. My XSCF version is XSCF> version -c xcp -v XSCF#0 (Active ) XCP0 (Current): 1072 OpenBoot PROM : 02.03.0000 XSCF : 01.07.0005 XCP1 (Reserve): 1072 could any guide m

  • Cant install itunes to my PC or to hubbies Mac. On PC it goes to the end of install

    Just bought an ipod nano for husbands birthday. Now we cant get itunes to install on either of our computers. On his Mac, when trying to install the 10.4 version it wants to try to update to 10.5...he doesnt want to do this as it will affect other pr

  • Tableview naviagionMode

    Hi, Could anyone give me a hint for the following point of view? I'd like to see in the Tableview 10 entries with the int. Table and displays 10 entries in first page. It works correctly. But, with the navigation buttons(top, buttom, next page, ..) a