Using PreparedStatement - OVER(ORDER BY ?) retrieved the rows un-sorted.
The ? in OVER(ORDER BY ?) is valid by setString(1, "columenName asc") in the following clause, this clause retrieved the rows un-sorted.
"
select * from (
select t.*, row_number() OVER(ORDER BY ?) AS row_number from t_accounts t
where lower(Acct_id) like '?'
) p where p.row_number <? and p.row_number>=?
"
so the following works:
"
select * from (
select t.*, row_number() OVER(ORDER BY "+NameOfColumn+" "+ "asc") AS row_number from t_accounts t
where lower(Acct_id) like '?'
) p where p.row_number <? and p.row_number>=?
"
* Environment: using ojdbc6.jar for Oracle database.
评论
发表评论