Re: PL/SQL Procedure Problem

From: Sybrand Bakker <gooiditweg_at_nospam.demon.nl>
Date: Wed, 15 Oct 2003 19:51:45 +0200
Message-ID: <t52rovo6pqli69g54hgjbbothakht6beos_at_4ax.com>


On Wed, 15 Oct 2003 12:11:22 +0000 (UTC), "James" <Jimbo_at_yahoo.com> wrote:

>"Sybrand Bakker" <gooiditweg_at_nospam.demon.nl> wrote in message
>news:tocqovk8s4eldbim81h76e6ij83k9pbpfn_at_4ax.com...
>> On Wed, 15 Oct 2003 11:16:38 +0000 (UTC), "Jimbo" <Jimbo_at_yahoo.com>
>> wrote:
>>
>> >Hi there, I'm new to PL/SQL and have been given the following procedure:
>> >
>> >create or replace procedure otime (hoursworked number) as
>> >overtimehours number;
>> >normalhours number;
>> >message varchar2(30);
>> >begin
>> >normalhours := 35;
>> >if hoursworked > normalhours then
>> >overtimehours := hoursworked - normalhours;
>> >message := 'Overtime Hours worked = ';
>> >dbms_output.put_line(message);
>> >dbms_output.put_line(overtimehours);
>> >else
>> >message := 'No Overtime!';
>> >dbms_output.put_line(message);
>> >end if;
>> >end;
>> >
>> >but when I EXECUTE this, I get an error and I think it is referring to
 the
>> >datatype(number) after 'hoursworked' in the 1st line. Could someone give
 me
>> >some help on this please?
>> >
>> >Also, how would I get the data from a column called hours in a table
 called
>> >EMP, when using a procedure?
>> >
>> >Many thanks,
>> >James
>> >
>> >
>> >
>> If you are also new to this newsgroup, you are advised always to
>> include *at least*
>> - The exact error message
>> - The version and O/S of Oracle you are using.
>> The procedure seems to compile, your reference to the way you are
>> executing it is so vague, one needs to resort to a crystall ball.
>> They have been sold out long since
>>
>
>Ok, here is what I receive after entering the command 'EXECUTE otime':
>
>BEGIN otime; END;
>
> *
>ERROR at line 1:
>ORA-06550: line 1, column 7:
>PLS-00306: wrong number or types of arguments in call to 'OTIME'
>ORA-06550: line 1, column 7:
>PL/SQL: Statement ignored
>
>I am using SQL *Plus on Oracle 9i on Windows XP.
>
>I haven't created tables to use with this procedure as I wasn't sure if it
>was necessary.
>
According to the procedure definition you need to use 1 actual parameter like
execute otime(100)
You are supplying 0 parameters and you didn't specify a default value in the formal definition of the procedure.

The procedure doesn't need any tables.

--
[Quoted] Sybrand Bakker, Senior Oracle DBA
Received on Wed Oct 15 2003 - 19:51:45 CEST

Original text of this message