Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make Oracle 'order by' behave like SQLServer?
    primarykey
    data
    text
    <p>i'm trying to write an Oracle query that sorts the results in the same way as MS SQL Server does. I'm toying with the <a href="http://download.oracle.com/docs/cd/B28359_01/olap.111/b28126/dml_functions_2038.htm" rel="nofollow">'NLSSORT'</a> function and it's parameters but i can't get exactly the same results as what i can see with MS SQL Server.</p> <p>The context is a generic data collection system that supports both Oracle and MS SQL Server. This is a pretty old system that is still under maintenance and development. No entity framework or any recent approaches to handle database interactions.</p> <p>With a simple order by on MS SQL Server i get this result:</p> <p>_TEST<br> 04-00031-IPE<br> 04-00044-OG<br> 0A-A<br> A0-A<br> SAZ2217 </p> <p>The same query on Oracle returns this:</p> <p>04-00031-IPE<br> 04-00044-OG<br> 0A-A<br> A0-A<br> SAZ2217<br> _TEST </p> <p>I have tried many combinations of NLSSORT parameters without any success.</p> <p>[edit]<br> By using the 'PUNCTUATION' NLS_SORT parameter value, i get results very close to the MS SQL sorting but there is still differences with substrings that contains sequences of numeric chars. Here is a sample query result:</p> <p>Oracle<br> 0031-CASTOR-BLOC1-AV-AP<br> 0031-CASTOR-BLOC1-AV-SP<br> 0031-CASTOR-BLOC1-SV-AP<br> 0031-CASTOR-BLOC1-SV-SP<br> 0031-CASTOR-BLOC10-DV-AP<br> 0031-CASTOR-BLOC10-DV-SP<br> 0031-CASTOR-BLOC2-DV-AP </p> <p>Ms SQL<br> 0031-CASTOR-BLOC10-DV-AP<br> 0031-CASTOR-BLOC10-DV-SP<br> 0031-CASTOR-BLOC1-AV-AP<br> 0031-CASTOR-BLOC1-AV-SP<br> 0031-CASTOR-BLOC1-SV-AP<br> 0031-CASTOR-BLOC1-SV-SP<br> 0031-CASTOR-BLOC2-DV-AP </p> <p>Thank you for your help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload