<bdo id='vW2dY'></bdo><ul id='vW2dY'></ul>

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

<tfoot id='vW2dY'></tfoot>

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

        如何将值动态传递给 IN 运算符?

        How to pass values to IN operator dynamically?(如何将值动态传递给 IN 运算符?)
        <legend id='dAuXn'><style id='dAuXn'><dir id='dAuXn'><q id='dAuXn'></q></dir></style></legend>

          • <tfoot id='dAuXn'></tfoot>

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

                  <tbody id='dAuXn'></tbody>

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

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

                  本文介绍了如何将值动态传递给 IN 运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想创建一个接受 IN 运算符的数组列表的过程.

                  I want to create a procedure which accepts an array list for IN operator.

                  例如:

                  Create or Replace Procedure Test (a Arraylist)
                  {
                  Select * from table1 where col1 IN (Arraylist)
                  }
                  

                  如果使用两个参数调用过程,那么查询应该是

                  If the procedure is called using two parameters then the query should be

                  Select * from table1 where col1 IN (val1,val2)
                  

                  如果过程是使用一个参数调用的,那么查询应该是

                  If the procedure is called using one parameter then the query should be

                  Select * from table1 where col1 IN (val1)
                  

                  推荐答案

                  创建集合类型:

                  CREATE TYPE stringlist IS TABLE OF VARCHAR2(100);
                  /
                  

                  然后您可以将其传递给过程并使用 MEMBER OF 运算符(而不是 IN 运算符):

                  Then you can pass it to a procedure and use the MEMBER OF operator (rather than the IN operator):

                  CREATE PROCEDURE Test (
                    in_list     IN  stringlist,
                    out_results OUT SYS_REFCURSOR
                  )
                  IS
                  BEGIN
                    OPEN out_results FOR
                    SELECT *
                    FROM   your_table
                    WHERE  your_column MEMBER OF in_list;
                  END;
                  /
                  

                  如果您从外部语言连接,那么您可以很容易地将数组传递给过程(Java 示例)或者您可以在 PL/SQL 中或从分隔列表创建列表.

                  If you are connecting from an external language then you can quite easily pass an array to the procedure (Java example) or you can create the list in PL/SQL or from a delimited list.

                  这篇关于如何将值动态传递给 IN 运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Accessing another user#39;s table within an Oracle Stored Procedure(在 Oracle 存储过程中访问另一个用户的表)
                  How to View Oracle Stored Procedure using SQLPlus?(如何使用 SQLPlus 查看 Oracle 存储过程?)
                  How to Pass Java List of Objects to Oracle Stored Procedure Using MyBatis?(如何使用 MyBatis 将 Java 对象列表传递给 Oracle 存储过程?)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)
                  How to find a text inside SQL Server procedures / triggers?(如何在 SQL Server 程序/触发器中查找文本?)
                    <tbody id='wc3dl'></tbody>

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

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

                          <bdo id='wc3dl'></bdo><ul id='wc3dl'></ul>

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