ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eka Gautama" <ekagaut...@seatech.com>
Subject ORDER BY CLAUSE
Date Tue, 08 Aug 2006 12:14:25 GMT
HI guys,

I am having problem currently. I have a very simple query with ORDER BY clause, but I want
to give parameter to what I am going to order. The parameter is comes from the UI.

Here is the SQL MAP :

<select id="QueryBranch" resultClass="HashTable" parameterClass="HashTable">
 SELECT  BRANCH_CODE 
     ,OFFICE_CODE 
 FROM   BRANCH_MASTER
 ORDER  BY #SortExpr# ASC
</select>

#SortExpr# will be either BRANCH_CODE or OFFICE_CODE which is supplied from UI.

The above statements give me result but not in order that I want. 

But, if I change into like this :

<select id="QueryBranch" resultClass="HashTable" parameterClass="HashTable">
 SELECT  BRANCH_CODE 
     ,OFFICE_CODE 
 FROM   BRANCH_MASTER
 ORDER  BY OFFICE_CODE ASC
</select>


It gives me the correct order of the records.


Am I missing something?? Help please....

Eka

Mime
View raw message