Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use Array array in oracle

Shulou Source: shulou.com Published: 2022-05-31 14:44:27 10月05日 Update

This article mainly shows you "how to use array in oracle". The content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn "how to use array in oracle" this article.

An example of a one-dimensional array is as follows:

-- Created on 2014-5-15 by ADMINISTRATORDECLARE TYPE Arr1 IS VARRAY(10) OF NUMBER; Tab_1 Arr1; TYPE Arr2 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; Tab_2 Arr2;BEGIN -- Test statements here Tab_1 := Arr1(1, 3, 4, 6, 3, 2, 8, 5); FOR a IN 1 .. Tab_1.Count LOOP Dbms_Output.Put_Line(' ' || Tab_1(a)); END LOOP; Tab_2(1) := 101; Tab_2(2) := 102; Tab_2(3) := 103; Tab_2(4) := 104; FOR b IN 1 .. Tab_2.Count LOOP Dbms_Output.Put_Line(' ' || Tab_2(b)); END LOOP;END;

Results:

13463285101102103104

Example of a two-dimensional array:

-- Created on 2014-5-15 by ADMINISTRATORDECLARE -- Local variables here TYPE Array1 IS VARRAY(10) OF NUMBER; TYPE Array2 IS VARRAY(10) OF Array1; Arr Array2;BEGIN Arr := Array2(Array1(11, 12, 13, 14, 15), Array1(21, 22, 23, 24, 25)); FOR i IN 1 .. Arr.Count LOOP FOR j IN 1 .. Arr(i).Count LOOP Dbms_Output.Put_Line(Arr(i) (j)); END LOOP; END LOOP;END;

Results:

11121314152122232425 The above is "oracle array how to use" all the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Arrays content articles examples results learning help easy to understand more organization knowledge editing industry information information channels channels one-dimensional two-dimensional research Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL macOS vpn Xiaomi