• <i id='aTg0k'><tr id='aTg0k'><dt id='aTg0k'><q id='aTg0k'><span id='aTg0k'><b id='aTg0k'><form id='aTg0k'><ins id='aTg0k'></ins><ul id='aTg0k'></ul><sub id='aTg0k'></sub></form><legend id='aTg0k'></legend><bdo id='aTg0k'><pre id='aTg0k'><center id='aTg0k'></center></pre></bdo></b><th id='aTg0k'></th></span></q></dt></tr></i><div id='aTg0k'><tfoot id='aTg0k'></tfoot><dl id='aTg0k'><fieldset id='aTg0k'></fieldset></dl></div>
        <bdo id='aTg0k'></bdo><ul id='aTg0k'></ul>

      <small id='aTg0k'></small><noframes id='aTg0k'>

        <legend id='aTg0k'><style id='aTg0k'><dir id='aTg0k'><q id='aTg0k'></q></dir></style></legend>
      1. <tfoot id='aTg0k'></tfoot>

        IN() 子句中的数组 oracle PLSQL

        时间:2023-09-19

      2. <i id='AvTAU'><tr id='AvTAU'><dt id='AvTAU'><q id='AvTAU'><span id='AvTAU'><b id='AvTAU'><form id='AvTAU'><ins id='AvTAU'></ins><ul id='AvTAU'></ul><sub id='AvTAU'></sub></form><legend id='AvTAU'></legend><bdo id='AvTAU'><pre id='AvTAU'><center id='AvTAU'></center></pre></bdo></b><th id='AvTAU'></th></span></q></dt></tr></i><div id='AvTAU'><tfoot id='AvTAU'></tfoot><dl id='AvTAU'><fieldset id='AvTAU'></fieldset></dl></div>
          <tfoot id='AvTAU'></tfoot>
          <legend id='AvTAU'><style id='AvTAU'><dir id='AvTAU'><q id='AvTAU'></q></dir></style></legend>

          • <bdo id='AvTAU'></bdo><ul id='AvTAU'></ul>

                <tbody id='AvTAU'></tbody>

                <small id='AvTAU'></small><noframes id='AvTAU'>

                  本文介绍了IN() 子句中的数组 oracle PLSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我将字符串数组(plcListchar)传递给存储过程,我想在 IN() 子句中使用这个字符串数组.

                  I am passing String array(plcListchar) to Stored Procedure, i would like to use this String array in IN() clause.

                  我不能在 IN() 子句中直接使用 plcListchar.让我展示我如何在 JAVA 中创建 plcListchar 字符串数组.

                  i can not use plcListchar directly in IN() clause. Let me show how i am crating plcListchar string array in JAVA.

                   String array[] = {"o", "l"}; 
                   ArrayDescriptor des = ArrayDescriptor.createDescriptor("CHAR_ARRAY", con);
                   ARRAY array_to_pass = new ARRAY(des,con,array);            
                   callStmtProductSearch.setArray(4, array_to_pass);
                  

                  用于装箱 CHAR_ARRAY,

                  for crating CHAR_ARRAY,

                  create or replace type CHAR_ARRAY as table of varchar2;
                  

                  我想在 IN 子句中使用 plcListchar.以下是我的存储过程.

                  i want use plcListchar in IN clause. the following is my Stored Procedure.

                  CREATE OR REPLACE PROCEDURE product_search(
                              status IN varchar2, 
                              plcList IN varchar2,
                              i_culture_id IN number,
                              plcListchar IN CHAR_ARRAY,
                              status_name OUT  varchar2, 
                              culture_code  OUT varchar2)
                  AS  
                      CURSOR search_cursor IS
                      SELECT p.status_name, p.culture_code
                                  FROM PRISM_ITEM_cultures@prism p
                                  WHERE p.publishable_flag=1 
                                  AND p.isroll =0 
                                  AND status = '-1'
                                  AND p.plc_status IN ( );
                   BEGIN
                             OPEN search_cursor;
                             FETCH search_cursor INTO status_name, culture_code ;
                             CLOSE search_cursor;
                   END;
                  

                  能否请您建议我如何使用,如果您想建议任何其他逻辑,那就太好了.

                  Could you please suggest me how to use, if you like to suggest any other logic, it is great.

                  推荐答案

                  假设你的集合是在 SQL 中定义的,而不仅仅是在 PL/SQL 中,你可以使用 TABLE 操作符(定义你发布在语法上无效-您需要为 VARCHAR2)

                  Assuming that your collection is defined in SQL, not just in PL/SQL, you can use the TABLE operator (the definition you posted isn't syntactically valid-- you'd need to specify a length for the VARCHAR2)

                  AND p.plc_status IN (SELECT column_value
                                         FROM TABLE( plcListchar ))
                  

                  因为我没有你的表,一个使用 SCOTT 模式的例子

                  Since I don't have your tables, an example using the SCOTT schema

                  SQL> create type ename_tbl is table of varchar2(30);
                    2  /
                  
                  Type created.
                  
                  SQL> ed
                  Wrote file afiedt.buf
                  
                    1  declare
                    2    l_enames ename_tbl := ename_tbl( 'KING', 'SMITH' );
                    3  begin
                    4    for i in (select *
                    5                from emp
                    6               where ename in (select column_value
                    7                                 from table( l_enames )))
                    8    loop
                    9      dbms_output.put_line( 'ENAME = ' || i.ename );
                   10    end loop;
                   11* end;
                  SQL> /
                  ENAME = KING
                  ENAME = SMITH
                  
                  PL/SQL procedure successfully completed.
                  

                  这篇关于IN() 子句中的数组 oracle PLSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:与 Oracle 的 CONNECT BY ... START WITH 等效的 PostgreSQL 语法是什么? 下一篇:如何在 Oracle 中使用 Timestamp_to_scn 和 Scn_to_timestamp?

                  相关文章

                    <bdo id='mqOZo'></bdo><ul id='mqOZo'></ul>
                • <legend id='mqOZo'><style id='mqOZo'><dir id='mqOZo'><q id='mqOZo'></q></dir></style></legend>

                  1. <small id='mqOZo'></small><noframes id='mqOZo'>

                      <i id='mqOZo'><tr id='mqOZo'><dt id='mqOZo'><q id='mqOZo'><span id='mqOZo'><b id='mqOZo'><form id='mqOZo'><ins id='mqOZo'></ins><ul id='mqOZo'></ul><sub id='mqOZo'></sub></form><legend id='mqOZo'></legend><bdo id='mqOZo'><pre id='mqOZo'><center id='mqOZo'></center></pre></bdo></b><th id='mqOZo'></th></span></q></dt></tr></i><div id='mqOZo'><tfoot id='mqOZo'></tfoot><dl id='mqOZo'><fieldset id='mqOZo'></fieldset></dl></div>

                    1. <tfoot id='mqOZo'></tfoot>