Home » Developer & Programmer » Reports & Discoverer » help me error correction.
help me error correction. [message #496335] Sat, 26 February 2011 22:30 Go to next message
helloworld_28
Messages: 60
Registered: October 2010
Member
hi,

iam new reports,i pratice report , while doing formula colum i used this function it shows error.

function CF_1Formula return Number as
a  number;
begin
	a :=:sal+:comm;
	if a=null then
  return (o);
	else
		return (a);
end
REP-737: Should be a function with return type '<returntype>'.


please help in correction
Re: help me error correction. [message #496338 is a reply to message #496335] Sun, 27 February 2011 00:15 Go to previous messageGo to next message
ranamirfan
Messages: 529
Registered: January 2006
Location: Pakistan / Saudi Arabia
Senior Member

Dear,
Please try this.Function Always return a Value.
function CF_1Formula return Number as
A  number;
B Number;
begin
	A :=Nvl(:sal,0)+ Nvl(:comm,0);

	IF ( A is Null or A=0 ) then
            B:=0;
        Else
            B:= A;
        END IF;
        
        Return B;
       
end


Hope it'll help you.

Regards,

Irfan
Re: help me error correction. [message #496346 is a reply to message #496338] Sun, 27 February 2011 03:16 Go to previous message
Littlefoot
Messages: 19648
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The error comes from the fact that nothing is EQUAL to NULL. In other words, instead of
if a = null then
you should have used
if a is null then

As "sal + comm" was NULL, function didn't return any value which caused an error.


Another (shorter) way might be this:
function CF_1Formula return Number as
begin
  return case when :sal + :comm is null then 0
              else :sal + :comm
         end;
end;

[Updated on: Sun, 27 February 2011 03:17]

Report message to a moderator

Previous Topic: Issue in Matrix Report and NULL Values
Next Topic: FRM- 41213: Unable to connect to the report server error
Goto Forum:
  


Current Time: Wed Oct 01 04:53:55 CDT 2014

Total time taken to generate the page: 0.09380 seconds