Home » RDBMS Server » Server Administration » Find maximum value without using max function
Find maximum value without using max function [message #370500] Wed, 08 December 1999 11:19 Go to next message
SQL beginner
Messages: 1
Registered: December 1999
Junior Member
I need to write a program in PL/SQL that will
find the max value from the table without
using the max function.
I tried with assigning the temp variable value of 0 and
then checking against that value.
Cursor file is created but I keep getting a message that the file is already opened??????????????
Any thoughts?
thanks
Re: Find maximum value without using max function [message #370501 is a reply to message #370500] Wed, 08 December 1999 12:44 Go to previous messageGo to next message
Andy McGoldrick
Messages: 1
Registered: December 1999
Junior Member
You can do this by creating a cursor for the select, and order by desc on the field you want maxed.

Then
open cursor cursor_name;
fetch cursor_name into my_variable;
close cursor_name;

If you create a record and select into this you will have the row that is the maximum.

Hopefully this will help you

Andy
Re: Find maximum value without using max function [message #371599 is a reply to message #370501] Sun, 12 November 2000 06:46 Go to previous message
vinay joshi
Messages: 1
Registered: November 2000
Junior Member
Is any way doing this using sql select statement
without using cursor
Previous Topic: Rollback Segment Survey
Next Topic: How do I insert data into LONG column
Goto Forum:
  


Current Time: Thu May 02 10:08:01 CDT 2024