Skip to content
Advertisement

PLSQL – Use variable array on where clause IN

I am looking to use an array of values in the WHERE IN condition.

After research, I saw that I had to make a “CREATE TYPE”, since a “TYPE” in local does not work. This solution does not suit me, I do not want to make a new TYPE in Oracle, since the database is used for an ERP/PGI I do not wish to pollute with my little need.

My request is the following:

It is the value “(’14’,’27’,’50’,’61’,’76’)” that I would like to set as a variable, but only in my program.

Do you have any ideas other than “CREATE TYPE”?

Advertisement

Answer

As you don’t want to create your own type, use built-in one – sys.odcivarchar2list. For example, fetch employees who are either clerks or managers:


If you want to declare a variable whose datatype is sys.odcivarchar2list (so, you’re in a PL/SQL procedure), then

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement