Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7159995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:19:27+00:00 2026-05-28T13:19:27+00:00

In PL/SQL, you can specify the values for the IN operator using concatenation: v_sql

  • 0

In PL/SQL, you can specify the values for the IN operator using concatenation:

v_sql := 'select field1
from table1
where field2 in (' || v_list || ')';

Is it possible to do the same using a variable?

v_sql := 'select field1
from table1
where field2 in (:v_list)'; 

If so, how?

EDIT: With reference to Marcin’s answer, how do I select from the resultant table?

declare

cursor c_get_csv_as_tables is
select in_list(food_list) food_list
from emp_food
where emp_type = 'PERM';

cursor c_get_food_list (v_food_table varchar2Table)is
select *
from v_food_table;

begin
    for i in c_get_csv_as_tables loop
        for j in c_get_food_list(i.food_list) loop
            dbms_output.put_line(j.element);
        end loop;
    end loop;
end;

I get the following error:

ORA-06550: line 10, column 6:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 9, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 15, column 34:
PLS-00364: loop index variable 'J' use is invalid
ORA-06550: line 15, column 13:
PL/SQL: Statement ignored
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:19:28+00:00Added an answer on May 28, 2026 at 1:19 pm

    Like in @Sathya link, you can bind the varray (I took @Codo example):

    CREATE OR REPLACE TYPE str_tab_type IS VARRAY(10) OF VARCHAR2(200);
    /
    DECLARE
      l_str_tab str_tab_type;
      l_count NUMBER;
      v_sql varchar2(3000);
    BEGIN
      l_str_tab := str_tab_type();
      l_str_tab.extend(2);
      l_str_tab(1) := 'TABLE';
      l_str_tab(2) := 'INDEX';
    
      v_sql := 'SELECT COUNT(*) FROM all_objects WHERE object_type IN (SELECT COLUMN_VALUE FROM TABLE(:v_list))';
    
      execute immediate v_sql into l_count using l_str_tab;
    
      dbms_output.put_line(l_count);
    END;
    /
    

    UPDATE: the first command can be replaced with:

    CREATE OR REPLACE TYPE str_tab_type IS TABLE OF VARCHAR2(200);
        /
    

    then call:

    l_str_tab.extend(1);
    

    when ever you add a value

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: SQL Delete: can't specify target table for update in FROM clause I
In SQL you can use SELECT * FROM INFORMATION_SCHEMA.TABLES etc to get information about
In SQL you can selecta constant value: Select Constant Text, Column1, Column2 From TableX
Possible Duplicate: SQL Server: Can I Comma Delimit Multiple Rows Into One Column? I
I can not specify the correct path to the directory with .sql files. I
Can anyone tell me how I can control the output from an SQL stored
What SQL can be used to list the tables, and the rows within those
When I enter an object into the DB with Linq-to-SQL can I get the
Can SQL Server 2000 be used as the database for LINQ to SQL? Does
In SQL one can write a query that searches for a name of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.