Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PLS-00382 Error - expression is of wrong type

582176May 19 2008 — edited May 19 2008
Hi all,

I have a package with 1 procedure and 1 function that returns a TABLE type. When I call the function from the procedure it returns the PLS-00382 error. I think I've declared the types correctly etc, but I wouldn't mind one of you guys taking a look at the code to see if I've missed anything glaringly obvious! Thanks

Basically, the function will split an input string and store the individual elements in the table . At the moment the procedure just dbms_outputs the elements.

Here's the code so far...

CREATE OR REPLACE
PACKAGE BODY PCK_STRING_SPLIT is
type myTableType is table of varchar2(255);

function str2tbl
(p_str in varchar2,
p_delim in varchar2 default ' ')
return myTableType
as

l_str long default p_str || p_delim;
l_n number;
l_data myTableType := myTabletype();
begin
loop
l_n := instr( l_str, p_delim );
exit when (nvl(l_n,0) = 0);
l_data.extend;
l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
l_str := substr( l_str, l_n+length(p_delim) );
end loop;
return l_data;
end str2tbl ;

procedure p_split_string(pv_string in varchar2) is
v_array myTableType;

begin

FOR i IN 1 .. v_array.COUNT LOOP
v_array := str2tbl(pv_string);
DBMS_OUTPUT.PUT_LINE (v_array(i));
END LOOP;

end p_split_string;

END PCK_STRING_SPLIT;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 16 2008
Added on May 19 2008
14 comments
1,050 views