Problem with Calling Procedure (PL/SQL) [message #346419] |
Mon, 08 September 2008 08:59  |
Creems
Messages: 70 Registered: July 2007 Location: Johannesburg
|
Member |
|
|
Hello,
I created the function below and when I tried to call it I get an error that wrong number or arguments.
I called the function (bond_cal) from SQL*Plus as:
SQL> exec bond_cal(150000, 5);
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BOND_CAL'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Please do put me through as I'm just learning PL/SQL proper. And below is the code
create or replace function bond_cal
(
amount in number,
months out number,
years in number,
interest out number,
insurance in number := 700,
bond in out number
)
return number
as
/* This program is used to calculate bond payable on your mortgage
with interest rate, service charges and insurance fees included.
With the following values as default,
insurance = R700
interest rate = 36/100
*/
begin
months := years * 12;
interest := amount * ( 36 / 100);
bond := (amount / months) + interest + insurance;
-- dbms_output.put_line('Bond Payable: '||bond||' per month');
end;
/
It ran successfully but when I want to call it ... it gives error. Maybe I passed wrong arguments ... I dont know
Can anyone help me please.
Thanks in good anticipation.
Creems
|
|
|
|
|
Re: Problem with Calling Procedure (PL/SQL) [message #346481 is a reply to message #346419] |
Mon, 08 September 2008 12:39   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
CherishMe wrote on Mon, 08 September 2008 09:59 |
I created the function below and when I tried to call it I get an error that wrong number or arguments.
I called the function (bond_cal) from SQL*Plus as:
SQL> exec bond_cal(150000, 5);
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BOND_CAL'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
|
exec is used to execute a procedure, not a function. This error message is fudged.
|
|
|
|
|
Re: Problem with Calling Procedure (PL/SQL) [message #346719 is a reply to message #346592] |
Tue, 09 September 2008 08:51  |
 |
Michel Cadot
Messages: 68761 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
@milind.khadloya
Also:
Michel Cadot wrote on Mon, 08 September 2008 17:08 | As always, please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
|
is also for those who answer.
Regards
Michel
|
|
|