• <small id='F3o5q'></small><noframes id='F3o5q'>

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

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

        Oracle PL/SQL - 如何创建一个简单的数组变量?

        时间:2023-09-18
        • <i id='FMIDw'><tr id='FMIDw'><dt id='FMIDw'><q id='FMIDw'><span id='FMIDw'><b id='FMIDw'><form id='FMIDw'><ins id='FMIDw'></ins><ul id='FMIDw'></ul><sub id='FMIDw'></sub></form><legend id='FMIDw'></legend><bdo id='FMIDw'><pre id='FMIDw'><center id='FMIDw'></center></pre></bdo></b><th id='FMIDw'></th></span></q></dt></tr></i><div id='FMIDw'><tfoot id='FMIDw'></tfoot><dl id='FMIDw'><fieldset id='FMIDw'></fieldset></dl></div>
            <tbody id='FMIDw'></tbody>

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

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

                • <tfoot id='FMIDw'></tfoot>
                • <legend id='FMIDw'><style id='FMIDw'><dir id='FMIDw'><q id='FMIDw'></q></dir></style></legend>

                  本文介绍了Oracle PL/SQL - 如何创建一个简单的数组变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想创建一个可在我的 PL/SQL 代码中使用的内存中数组变量.我在 Oracle PL/SQL 中找不到任何使用纯内存的集合,它们似乎都与表相关联.我希望在我的 PL/SQL(C# 语法)中做这样的事情:

                  I'd like to create an in-memory array variable that can be used in my PL/SQL code. I can't find any collections in Oracle PL/SQL that uses pure memory, they all seem to be associated with tables. I'm looking to do something like this in my PL/SQL (C# syntax):

                  string[] arrayvalues = new string[3] {"Matt", "Joanne", "Robert"};
                  

                  甲骨文:9i

                  推荐答案

                  您可以将 VARRAY 用于固定大小的数组:

                  You can use VARRAY for a fixed-size array:

                  declare
                     type array_t is varray(3) of varchar2(10);
                     array array_t := array_t('Matt', 'Joanne', 'Robert');
                  begin
                     for i in 1..array.count loop
                         dbms_output.put_line(array(i));
                     end loop;
                  end;
                  

                  对于无界数组或 TABLE:

                  Or TABLE for an unbounded array:

                  ...
                     type array_t is table of varchar2(10);
                  ...
                  

                  这里的表"一词与数据库表无关,令人困惑.两种方法都创建内存数组.

                  The word "table" here has nothing to do with database tables, confusingly. Both methods create in-memory arrays.

                  使用其中任何一个,您都需要在添加元素之前初始化和扩展集合:

                  With either of these you need to both initialise and extend the collection before adding elements:

                  declare
                     type array_t is varray(3) of varchar2(10);
                     array array_t := array_t(); -- Initialise it
                  begin
                     for i in 1..3 loop
                        array.extend(); -- Extend it
                        array(i) := 'x';
                     end loop;
                  end;
                  

                  第一个索引是 1 而不是 0.

                  The first index is 1 not 0.

                  这篇关于Oracle PL/SQL - 如何创建一个简单的数组变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:禁用 Oracle 中的所有表约束 下一篇:PL/SQL 中受 UPDATE 影响的行数

                  相关文章

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

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

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