oracle - PL/SQL - Use "List" Variable in Where In Clause -


in pl/sql, how declare variable mylistofvalues contains multiple values (myvalue1, myvalue2, etc.)

select *  databasetable  databasetable.field in mylistofvalues 

i using oracle sql developer

use collection:

create type varchar2tabletype table of varchar2(200); 

or use built-in type sys.odcivarchar2list or sys.odcinumberlist:

variable cursor refcursor;  declare   your_collection sys.odcivarchar2list := sys.odcivarchar2list(); begin   your_collection.extend( 100 );    your_collection(  1) := 'some value';   your_collection(  2) := 'some other value';   -- ...   your_collection(100) := dbms_random.string( 'x', 20 );    open :cursor   select t.*     your_table t          inner join          table( your_collection ) c          on t.id = c.column_value; end; /  print cursor; 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -