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!

select from table of varchar2

user635881Nov 24 2008 — edited Nov 24 2008
Hi to all,
i have the following code:

TYPE tabella IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
tabe tabella;

BEGIN

--In this functioni fill tabe inserting in it values (function follows in the post)+
string:=tokenizerStringa2(tipoEdificioIn,tabe);

after this call to function i would like to open a cursor as follow:

open cur for select field1 from table1 where field1 in (select * from tabe);

but this give me an error because compiler wants that i declare tabe (it see tabe as a fisical table in db).
Could i modify open cur to take in cosideration tabe?
Thanks

+...+
+...+
+...+
function tokenizerStringa2 (param_to_split varchar2,tabe out tabella) return varchar2 is

type t_vector is table of varchar2(10) index by binary_integer;
v_value t_vector;
v_index_next pls_integer := 1;
v_index_pipe pls_integer := 1;
i pls_integer := 0;
stringa varchar2(100);
trovato boolean;

begin

trovato:=false;

v_index_pipe := instr(param_to_split, '|', 1, 1);

if v_index_pipe > 0 then

while v_index_pipe > 0 loop

i := i 1;+



v_value(i) := ''''|| substr(param_to_split, v_index_next, v_index_pipe - v_index_next) || '''';
v_index_next := v_index_pipe 1;+
v_index_pipe := instr(param_to_split, '|', v_index_next, 1);



tabe(i):= v_value(i);
if i>0 then
stringa:= stringa ||','|| v_value(i);
end if;



if trovato=false then
stringa:=replace(stringa,',','');
trovato:=true;
end if;



dbms_output.put_line(v_value(i));

end loop;
stringa:=RTRIM(stringa,',');
dbms_output.put_line(stringa);
end if;



return stringa;



end tokenizerStringa2;

Edited by: user635881 on 24-nov-2008 6.04

Edited by: user635881 on 24-nov-2008 6.09

Edited by: user635881 on 24-nov-2008 6.19
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2008
Added on Nov 24 2008
16 comments
5,540 views