Remembering that Oracle is the most widely installed Database in the world
That said try
SELECT p.Column FROM org.usiis.struts.PatientSearchForm p ORDER BY p.lastName WHERE row_num < = 1
Martin-
----- Original Message ----- From: "Emir Causevic" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, May 16, 2005 6:19 PM
Subject: RE: [castor-user] [JDO] LIMIT with oracle?
The Problem is that here is no LIMIT, TOP, or similar on Oracle. It's just that silly rownum, which you can use for that purpose and it doesn't behave always as one would expect. Especially with locking involved... I hate this in Oracle and really would like to hear if anyone has a way to do this right... What is your desired SQL query?
BTW, if Castor is using "FOR UPDATE" in it's SQL query - Oracle doesn't allow ORDER BY in such a query.
Regards, Emir
-----Original Message----- From: Eric Anderson [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 17, 2005 12:02 AM To: [email protected] Subject: Re: [castor-user] [JDO] LIMIT with oracle?
What is the correct syntax? I tried the following
SELECT p FROM org.usiis.struts.PatientSearchForm p LIMIT $1 ORDER BY p.lastName
but got
org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token type was found near ORDER (found KEYWORD_ORDER, but expected END_OF_QUERY) at org.exolab.castor.jdo.oql.Parser.match(Parser.java:222) at org.exolab.castor.jdo.oql.Parser.getParseTree(Parser.java:184) at org.exolab.castor.jdo.engine.OQLQueryImpl.create(OQLQueryImpl.java:23 ) at org.exolab.castor.jdo.engine.DatabaseImpl.getOQLQuery(DatabaseImpl.ja a:465) at org.usiis.struts.PersistenceManager.getPatientSearchQuery(Persistence anager.java:1828) at org.usiis.struts.PersistenceManager.patientSearch(PersistenceManager.
>>> [EMAIL PROTECTED] 05/11/05 4:35 PM >>> On 5/11/05, Eric Anderson <[EMAIL PROTECTED]> wrote: > > I have tried LIMT $1 and rownum < $1 and can't seem to get it to work? > Am I doing it wrong? > oql.bind(100); > > http://castor.org/oql.html#Limit-Clause doesn't show it as different?
Take a look here:
http://castor.codehaus.org/release-notes.html
and search for the word limit.
Also, by looking at the code, it appears that the ORDER BY clause is required for Oracle.
It looks like the docs need to be updated to reflect the current functionality.
> Also is there a way to search the mailing list of archives? I don't see > it here? > > http://archive.codehaus.org/castor/user/
There are searchable archives available from the following locations:
http://www.mail-archive.com/[email protected]/
http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=castor-user&r=1&w=2
http://marc.theaimsgroup.com/?l=castor-dev&r=1&w=2
http://news.gmane.org/gmane.comp.java.castor.user
http://news.gmane.org/gmane.comp.java.castor.devel
I have no idea why this page only lists the Codehaus archive now:
http://castor.codehaus.org/lists.html
It looks like we've got some updating to do WRT the docs. Thanks for pointing out this stuff Eric.
Bruce -- perl -e 'print unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );'
The Castor Project http://www.castor.org/
Apache Geronimo http://geronimo.apache.org/
-- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 5/13/2005
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 5/13/2005

