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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL Function Question

Status
Not open for further replies.

EssJayKay

Programmer
Dec 2, 2002
18
US
Can a function take no input parameters as such:

function get_lo_post () return number
is
ret_value number;
begin
ret_value := 0;
select min(post) into ret_value from post_lookup;
return ret_value;
EXCEPTION
WHEN OTHERS THEN
return 0;
end;

I am getting an error on the declaration which is as follows:

function get_lo_post () return number;
 
When a function or procedure takes no parameters, omit the ().

So your function signature would be:
Code:
function get_lo_post return number

Hope this helps.
 
Thanks,

When calling the function should it be called with or without the parens?

 
Either will work. I have a personal preference for always puting the parentheses in the code even if not needed, it improves readability (for me, at least).

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top