---
title: "PL/SQL入门系列--集合之:可变数组"
author: "wilent"
date: "2006-12-28T21:48:47Z"
tags: []
slug: "pl-sql"
draft: false
lastmod: "2006-12-28T21:48:47Z"
id: 41313
url: "https://wilent.iteye.com/blog/41313"
---

本文向你介绍集合的:可变数组.  
          可变数组的访问与嵌套表,index-by表访问类似.  
          一. 定义语法  
         TYPE type\_name IS {VARRAY | VARYING ARRAY} (maximum\_size) OF element\_type\[NOT NULL];  
          二.示例  
          1. number类型.  
         

sql 代码

 

01. Declare
02. Type numbers Is Varray(20) Of Number(3);
03. null\_list numbers;
04. list1 numbers := numbers(1,2);
05. list2 numbers := numbers(Null);
06. Begin
07. If null\_list Is Null Then
08. dbms\_output.put\_line('null\_list 为空');
09. End If;
10. If list2(1) Is Null Then
11. dbms\_output.put\_line('list2(1) 也为空');
12. End If;
13. End;