Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to get the higher value?
Sure you can use PL/SQL.
Write a function then select from the function:
ie:
CREATE or REPLACE
Function FOO1 RETURN NUMBER IS
n_Num NUMBER;
BEGIN
Select -- something
INTO n_Num
FROM -- somewhere
RETURN(n_Num);
END;
CREATE OR REPLACE
FUNCTIOIN FOO2 RETURN NUMBER IS
n_Num NUMBER;
BEGIN
SELECT -- something
INTO n_Num
FROM -- somwhere
RETURN(n_NUM);
END;
In the SQL refer to the functions i.e. SELECT Foo1, Foo2...
or Select Sub1.Number, Sub2.Number, etc
FROM (
SELECT FOO1 Number From DUAL ) Sub1, ( SELECT FOO2 Number FROM Dual ) Sub2
I would suspect that a MAX would be in the mix.
Good luck.
On Tue, 14 Mar 2000 mitch23_at_hotmail.com wrote:
> I need to to compare the numeric values in two separate select
> statements and get the higher number...Is there a way to do this in
> pure SQL? I can't use PL/SQL as this must be run with Crystal Reports.
>
> Thanks in advance.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
>
Received on Tue Mar 14 2000 - 09:15:06 CST
![]() |
![]() |