Home » SQL & PL/SQL » SQL & PL/SQL » New Issue in ORDER BY 10g
New Issue in ORDER BY 10g [message #238289] Thu, 17 May 2007 06:02 Go to next message
atulrsingh
Messages: 55
Registered: November 2006
Location: Mumbai
Member
Hi,

I have found one discripency in the results from 9i and 10g in a query.

Query:

SELECT gtablecode2,
gtablename,
ans_returned_chr
FROM answer_table
order by decode(ans_returned_chr,'AR',1,3);


OUTPUT in 10G:

GTABLECODE2 GTABLENAME ANS_RETURNED_CHR

FRE French QC
ENG English


OUTPUT in 91G:

GTABLECODE2 GTABLENAME ANS_RETURNED_CHR

ENG English
FRE French QC


The Ordering is showing different results... pls analyse

Re: New Issue in ORDER BY 10g [message #238295 is a reply to message #238289] Thu, 17 May 2007 06:18 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Well, your order by gives both of the rows the same value - you give 'AR' a value of 1 and everything else a value of 3.
So, as there is no defined order that they should appear in, you cannot guarantee the order they will appear in.

As there is no reason why rows from queries run on two different databases should come back in the same order, this is entirely expected behaviour, and doesn't even indicate that there has neccessarily been a change in the order by logic.

[Updated on: Thu, 17 May 2007 06:20]

Report message to a moderator

Previous Topic: Unix command through external procedure in C running successfully but showing no output.
Next Topic: functions
Goto Forum:
  


Current Time: Fri Dec 09 02:03:27 CST 2016

Total time taken to generate the page: 0.08616 seconds