Variable inside a cursor
CREATE OR REPLACE TYPE BRANCH AS TABLE OF VARCHAR2(5);
create or replace function Example RETURN NUMBER AS
branches BRANCH;
cursor ex1 IS select node from TABLE_EXAMPLE1 where node IN (branches);
BEGIN
select * BULK COLLECT INTO branches
from TABLE_EXAMPLE2;
RETURN 1;
END;
This example above is very simple and i know that i could write the query directly inside de IN clause, but i just made this code to be more easy to understand.
When i compile ,the function throws an error saying that the branches variable is not from VARCHAR2 type.
My question is : How can i pass a variable (that would be a table already fullfilled) to inside the IN clause in the cursor ? The branches variable is from BRANCH type that is a VARCHAR2 table, but the compiler says that is not the expected type(he expect VARCHAR2 and i am passing BRANCH type)
if anyone could help i would be very thankful.