problem with sorting order in result set
Hi,
i am using jdbc
[b]and my query is
String sql="select empname from emp order by lower(empname) where userid=?";
pst = con.prepareStatement(sql);
pst.setString(1,userId);
rs = pst.executeQuery();[/b]in oracle side the results are in sorted order
by where in java console they are not comming in sorted order.
can any one help how to get result set in exact sorted order.
with regards
ss
[486 byte] By [
shannua] at [2007-11-27 11:05:40]

# 2
yes i know this in not releated to jsf but it is related to java
you are not properly understand my question.
when i am firing this query from java jdbc
String sql="select empname from emp order by lower(empname) where userid=?";
pst = con.prepareStatement(sql);
pst.setString(1,userId);
rs = pst.executeQuery();i
in java the result set which i am getting in not order how actually the results are generated in oracle.
means
in oracle side
empname
a
a
ab
b
c
and in java result set
i am getting is
ab
a
c
b
a
with regards
ss
# 3
Put the WHERE-Part first and THEN the "ORDER BY"-part
String sql="SELECT empname FROM emp WHERE userid=? ORDER BY lower(empname) ";
normaly you have:
SELECT ... FROM ... WHERE ... ORDER BY ... GROUP BY ... HAVING ...
# 4
> yes i know this in not releated to jsf but it is
> related to java
> you are not properly understand my question.
Yes, I do properly understand the question and I know the answer. It has nothing to do with Java and everything to do with SQL.