Wednesday, 15 May 2013

collections - Pl sql Oracle invalid use of type name or subtype name -



collections - Pl sql Oracle invalid use of type name or subtype name -

i trying search array of uppercase letters see if letter in array. getting error: error(7,27): pls-00330: invalid utilize of type name or subtype name can't seem prepare it.

create or replace function fun_isupper(parcharat in varchar2) homecoming number varcharat varchar2(1) := parcharat; type upperchararr varray(4) of varchar2(1); array upperchararr := upperchararr('a', 'b', 'c', 'd'); begin if varcharat fellow member of upperchararr homecoming 1; else homecoming 0; end if; end;

you have declared type. utilize need declare variable of type.

" error error(7,6): pls-00306: wrong number or types of arguments in phone call 'member of'"

that because you're using varray. documentation advises us "there no mechanism comparing varrays." should utilize nested table instead. reason using varray if need retain order of elements in collection; don't think applies here. here working version:

create or replace function fun_isupper(parcharat in varchar2) homecoming number varcharat varchar2(1) := parcharat; type upperchararr table of varchar2(1); l_array upperchararr := upperchararr('a', 'b', 'c', 'd'); begin if varcharat fellow member of l_array homecoming 1; else homecoming 0; end if; end;

oracle collections plsql user-defined-types

No comments:

Post a Comment