Home » Developer & Programmer » Forms » call function with parameter in oracle forms
call function with parameter in oracle forms [message #560929] Tue, 17 July 2012 18:41 Go to next message
hassan08
Messages: 122
Registered: June 2011
Location: egypt
Senior Member
i have this function
create function xxx_sal (p_number in number)
return number is
v_sal number;
begin
select sum(sal)
into v_sal
from emp
where empno = p_number;
return v_sal;
end;
how can called it in oracle forms
Re: call function with parameter in oracle forms [message #560930 is a reply to message #560929] Tue, 17 July 2012 18:53 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
The same way you'd call it in PL/SQL. Most forms code is PL/SQL.
Have you even tried to call it?
Re: call function with parameter in oracle forms [message #560937 is a reply to message #560929] Tue, 17 July 2012 21:19 Go to previous messageGo to next message
hassan08
Messages: 122
Registered: June 2011
Location: egypt
Senior Member
but i called by
xxx_sal(7788);
but not executing and i want the number dynamic not be a manual i mean 7788 not write it manual
Re: call function with parameter in oracle forms [message #560954 is a reply to message #560937] Wed, 18 July 2012 00:13 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
"7788" would probably be a form item name, such as
:block.sum_sal := xxx_sal(:block.empno);
Re: call function with parameter in oracle forms [message #561017 is a reply to message #560929] Wed, 18 July 2012 05:16 Go to previous messageGo to next message
hassan08
Messages: 122
Registered: June 2011
Location: egypt
Senior Member
thank you Littlefoot it's done
Re: call function with parameter in oracle forms [message #561051 is a reply to message #560929] Wed, 18 July 2012 09:00 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
hassan08 wrote on Tue, 17 July 2012 19:41
i have this function
create function xxx_sal (p_number in number)
return number is
v_sal number;
begin
select sum(sal)
into v_sal
from emp
where empno = p_number;
return v_sal;
end;
how can called it in oracle forms


I see at least two fundamental problems.

1. You have no exception handler
2. wouldn't empno be unique in this table? If so, what is the point of a SUM?
Re: call function with parameter in oracle forms [message #561087 is a reply to message #561051] Wed, 18 July 2012 14:28 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What exception would you handle? SUM itself handles quite a few of them (such as several records for an employee in a table or no employee with that EMPNO).
Re: call function with parameter in oracle forms [message #561099 is a reply to message #561087] Wed, 18 July 2012 15:37 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Littlefoot wrote on Wed, 18 July 2012 15:28
What exception would you handle? SUM itself handles quite a few of them (such as several records for an employee in a table or no employee with that EMPNO).


I know, my 2 points are mutually exclusive. I was assuming that he didn't want SUM and just wanted to salary, which would need an exception handler.
Then I also pointed out the SUM may have been in error?
I was trying to find a way to point them out separately. I failed Sad
Re: call function with parameter in oracle forms [message #561103 is a reply to message #561099] Wed, 18 July 2012 16:33 Go to previous message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
/forum/fa/5767/0/
Previous Topic: retrieving previous record value of the same item in a block
Next Topic: Forms 11GR2 image manipulation
Goto Forum:
  


Current Time: Fri Jul 05 21:45:07 CDT 2024