Answer the question
In order to leave comments, you need to log in
How to declare an array in PL/SQL so that it can be used later in IN?
Good afternoon. Suppose there is a query with an IN condition (below is a simple example). Can I declare a collection of items ('IBM', 'Hewlett Packard', 'Microsoft') ahead of time in DECLARE as a constant?
SELECT *
FROM customers
WHERE customer_name IN ('IBM', 'Hewlett Packard', 'Microsoft');
Answer the question
In order to leave comments, you need to log in
Yes.
You can write your own utility type like:
create or replace type string_tab as table of varchar2(4000 char)
/
-- Если константа пакетная, то <package_name>.c_customers
select *
from customers
where customer_name in (select column_value from table(c_customers));
select *
from customers
where customer_name member of c_customers;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question