Find maximum value without using max function [message #370500] |
Wed, 08 December 1999 11:19 |
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 |
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
|
|
|
|