how to write exception code in the formula column [message #626170] |
Wed, 22 October 2014 00:23 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi all,
Suppose if i have code in the Formula column in the report , i need to display message where to add code?
IF :CF_1< 0 THEN
IF nvl(:CF_2,0) = 0
AND nvl(:CF_3,0) = 0 THEN
v_qty := abs(:CF_1);
RETURN nvl(v_qty, 0);
END IF;
if suppose coming(return value)CF_1 is 0(zero) then
IF 0< 0 THEN
...
....
end if;
how to add eexeption for the above code?
If v_qty >= abs(:CF_1) then
return nvl(v_qty, 0);
end if;
|
|
|
|
Re: how to write exception code in the formula column [message #626289 is a reply to message #626170] |
Fri, 24 October 2014 04:32 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi,
What values the below code returns? Can you please help me?
FUNCTION Cf_1 RETURN NUMBER
IS
v_qty NUMBER(20);
BEGIN
v_qty := 0;
IF Nvl(0,0) = 0 AND Nvl(0,0) <= 1
THEN
RETURN Nvl(v_qty, 0);
END IF;
IF Nvl(0,0) < 0
THEN
IF Nvl(0,0) = 0 AND Nvl(0,0) = 0
THEN
v_qty := abs(0);
RETURN Nvl(v_qty, 0);
END IF;
v_qty := Nvl(0,0);
IF v_qty >= Abs(0)
THEN
RETURN Nvl(v_qty, 0);
END IF;
IF Nvl(0,0) > 0
THEN
LOOP
v_qty := v_qty + Nvl(0,0);
EXIT
WHEN v_qty >= Abs(0);
END LOOP;
RETURN Nvl(v_qty, 0);
END IF;
v_qty := Abs(0);
RETURN Nvl(v_qty, 0);
END IF;
RETURN Nvl(v_qty, 0);
END;
Thanks
|
|
|
|
|
Re: how to write exception code in the formula column [message #626293 is a reply to message #626291] |
Fri, 24 October 2014 04:50 |
cookiemonster
Messages: 13958 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Are you seriously telling us you can't follow that code and work out which return statement will be run?
Have you even tried, because it's very obvious.
And what makes you think any special steps are required for run time compilation.
You do realize that whole thing is currently equivalent to RETURN 0; don't you?
|
|
|
|