Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: MAX NUMBER

Re: MAX NUMBER

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Wed, 23 Aug 2006 13:31:41 GMT
Message-ID: <J4GDKu.Ftv@igsrsparc2.er.usgs.gov>


Reiro wrote:
> hi ppl...
>
> i am entering dat in an access front end connect to an oracle database.
> i am using max (number) + 1 increasing my id...
>
> problem is ... if during testing i enter a number like 9999999 in the
> database.
> Even whn record is deleted i get the next value as 9999999 + 1.
> how do retrieve the maximum value that is in the table.
>
> thx in advance...
>

To retrieve the max number in a column of a table, use a query similar to the following:

SELECT MAX(column_name) FROM table_name;

However, adding one to this max number smells suspiciously like one should be using an Oracle Sequence as it will autoincrement an interval based on the last value used. Please read the Oracle docs (http://tahiti.oracle.com) for more information.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Wed Aug 23 2006 - 08:31:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US