0

I want to write query to database in Oracle stored procedure. I send to procedure array

TYPE NUMBER_ARRAY IS TABLE OF NUMBER;

in my query i want to limit result like that:

SELECT *
    FROM TABLE T
   WHERE ID IN
         (SELECT * FROM TABLE(CAST(NUMBER_ARRAY AS TABLE)))

but it returns errors:

PLS-00642 ORA-22906

1
  • 1
    "but it not work" - that's not a helpful description... Commented Mar 21, 2014 at 9:06

1 Answer 1

1
create or replace type NUMBER_ARRAY as TABLE OF NUMBER;

declare 
numvar number_array := number_array(); 
numvar1 number_array; 
begin 
for i in 1..10 loop 
  numvar.extend(); 
  numvar(i) := i; 
end loop; 
SELECT * bulk collect into numvar1 FROM TABLE(numvar);   

for i in numvar1.first..numvar1.last loop 
  dbms_output.put_line(numvar1(i)); 
end loop; 
end; 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.