Home » Developer & Programmer » Reports & Discoverer » how to write exception code in the formula column (oracle reports 10)
how to write exception code in the formula column [message #626170] Wed, 22 October 2014 00:23 Go to next message
mist598
Messages: 1191
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 #626176 is a reply to message #626170] Wed, 22 October 2014 02:35 Go to previous messageGo to next message
cookiemonster
Messages: 13895
Registered: September 2008
Location: Rainy Manchester
Senior Member
I have no idea what you're trying to achieve
Re: how to write exception code in the formula column [message #626289 is a reply to message #626170] Fri, 24 October 2014 04:32 Go to previous messageGo to next message
mist598
Messages: 1191
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 #626290 is a reply to message #626289] Fri, 24 October 2014 04:38 Go to previous messageGo to next message
Littlefoot
Messages: 21610
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It returns 0 (zero).
Re: how to write exception code in the formula column [message #626291 is a reply to message #626290] Fri, 24 October 2014 04:40 Go to previous messageGo to next message
mist598
Messages: 1191
Registered: February 2013
Location: Hyderabad
Senior Member
Thanks Littlefoot, i mean which value can you please give me more explanation? and what are the steps for run time compilation?
Quote:
It returns 0 (zero).

   RETURN Nvl(v_qty, 0); 
  END IF; 
  RETURN Nvl(v_qty, 0); 
END;

from last 3 lines of code, which return gives 0 (zero)?

[Updated on: Fri, 24 October 2014 04:43]

Report message to a moderator

Re: how to write exception code in the formula column [message #626293 is a reply to message #626291] Fri, 24 October 2014 04:50 Go to previous messageGo to next message
cookiemonster
Messages: 13895
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?
Re: how to write exception code in the formula column [message #626294 is a reply to message #626291] Fri, 24 October 2014 04:51 Go to previous message
cookiemonster
Messages: 13895
Registered: September 2008
Location: Rainy Manchester
Senior Member
mist598 wrote on Fri, 24 October 2014 10:40

Quote:
It returns 0 (zero).

   RETURN Nvl(v_qty, 0); 
  END IF; 
  RETURN Nvl(v_qty, 0); 
END;

from last 3 lines of code, which return gives 0 (zero)?

Neither - it'll never get that far.
Previous Topic: REP-0069: Internal error REP-57054: In-process job terminated:Terminated with error
Next Topic: How to catch Exact error from Report in calling Forms ( Dev.10g )
Goto Forum:
  


Current Time: Thu Oct 22 01:26:51 CDT 2020