|
|
|
|
|
|
| Re: wrong argument passed any suggestion [message #647750 is a reply to message #647747] |
Sat, 06 February 2016 21:32   |
 |
Barbara Boehmer
Messages: 9106 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
It helps if you explain what it is that you are trying to do. I am guessing that you are trying to create a procedure that declares a collection, populates the collection with a couple of values, then loops through the collection, outputting each value, then execute that procedure. If that is the case, then you have some unnecessary stuff and are missing some other stuff.
You need to use to_date to convert a string to a date, providing the date format of the provided string.
If you use 1 .. birthdays.count instead of birthdays.first .. birthdays.last it eliminates having to handle errors when there is no data.
Since your procedure does not have any input parameters, then you need to execute it without trying to pass any input parameter to it.
Please see the demonstration below.
SCOTT@orcl> create or replace procedure p1
2 as
3 type birthdates_d is table of date index by pls_integer;
4 birthdays birthdates_d;
5 begin
6 birthdays(1) := to_date ('20-mar-1972', 'dd-mon-yyyy');
7 birthdays(2) := to_date ('1-oct-1986', 'dd-mon-yyyy');
8 for i in 1. .. birthdays.count loop
9 dbms_output.put_line (birthdays(i));
10 end loop;
11 end p1;
12 /
Procedure created.
SCOTT@orcl> show errors
No errors.
SCOTT@orcl> begin
2 p1;
3 end;
4 /
Mon 20-Mar-1972
Wed 01-Oct-1986
PL/SQL procedure successfully completed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|