Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for calling a function inside a function

Status
Not open for further replies.

daddypost

Technical User
Oct 21, 2004
98
US
I have a function that has three parameters(v-mid,P_product_id, n). Inside that function I need to call another function called top_related_prod_type2 that have the same three parameters that were passed to the main function. The synatx around it looks like this:
if v_no_of_records < n then
TOP_RELATED_PROD_TYPE2(v_mid, n - v_no_of_records, p_product_id);
else
for rec_index in x loop
v_current_rec := v_current_rec + 1;
if v_current_rec = n then
return rec_index.product_id;

end if;
end loop;
end if;

v_no_of_records is a variable I define earlier. The problem is it keeps giving me the "TOP RELATED_PROD_TYPE2 is not a procedure or is not define" error. I tried putting execute immediate in front of it, and still gave me an error. Any ideas?
Thanks for the help.
 
Functions return values. you must have something to return the result of the function into:

Code:
declare
   myvar number;
begin
   myvar := function(x, y, z);
end;
 
daddypost said:
Thank you so much. Worked like a charm.
If that is the result, then Jim probably deserves a
star.gif
from you by your clicking on the link Thank jimirvine for this valuable post!, right?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm. The cost will be your freedoms and your liberty.”
 
DaddyPost said:
It is done. :)
I don't think so. (I see no
star.gif
for Jim yet. I'd do it myself, but I wanted to ensure that everything is working properly for you to award a
star.gif
(especially where you thought it had already occurred).

Cheers,

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm. The cost will be your freedoms and your liberty.”
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top