empire-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nguyen, Chieu X" <chieu.ngu...@verizon.com>
Subject RE: Building DBCommand
Date Wed, 18 Jun 2014 14:03:38 GMT
Hi Rainer,

Thank you for responding to my email.  I have try what you suggested and it works.  The only
issue with that is Oracle randomly selected # of rows to return.  The reason I need to put
in that format is because I want this scenario.

Let say I have 400 rows in a table, and I want to select those 400 row order by customer name.
 Now, I want to return that 1st 100 in that order.  Next, I want to run the same query but
this time I want it to return rows 101-200, then, rows 201-300, and finally rows 301-400.

I think the only I can achieved this is by running the query below.

select * from (
  select a.*, ROWNUM rnum from (
    <select statemenet with order by clause> // I know how to write this query.
  ) a where rownum <= MAX_ROW
) where rnum >= MIN_ROW


Thank You,



Chieu Nguyen
Chieu.nguyen@verizon.com

From: Rainer Döbele [mailto:doebele@esteam.de]
Sent: Wednesday, June 18, 2014 3:01 AM
To: user@empire-db.apache.org
Subject: re: Building DBCommand

Hi Nhuyen,
this is Oracle Syntax and it is already implemented for the Oracle driver.
All you need to to is the following:
1. Make sure you are using de DBDatabaseDriverOracle.
2. Use cmd. limitRows(...) and cmd. skipRows(...)
then it should generate the desired statement for you.
There is no need to wrap the command inside another command.
Best regards
Rainer


Von: Nguyen, Chieu X [mailto:chieu.nguyen@verizon.com]
Gesendet: Dienstag, 17. Juni 2014 22:43
An: user@empire-db.apache.org<mailto:user@empire-db.apache.org>
Betreff: Building DBCommand

Hi Rainer,

I was wondering how would I write the following SQL using EmpireDB.

select * from (
  select a.*, ROWNUM rnum from (
    <select statemenet with order by clause> // I know how to write this query.
  ) a where rownum <= MAX_ROW
) where rnum >= MIN_ROW

I would appreciate any suggestions.

Thank You,



Chieu Nguyen
Chieu.nguyen@verizon.com<mailto:Chieu.nguyen@verizon.com>


Mime
View raw message